answersLogoWhite

0

How can i Write jsp page?

Updated: 8/16/2019
User Avatar

Wiki User

13y ago

Best Answer

A JSP File Contents:

A JSP file can contain the following:

a. HTML contents

b. JavaScript

c. Java Code

Combining the features of the above 3 mentioned items; we get a powerful entity called the JSP. JSPs are used for the User Interface layer or the more colloquially called Front End layer of any J2EE application.

JSP Skeleton

Below is how a Skeleton JSP File would look like. (The file has to be saved as .jsp)

// Page Imports

<%@ page import = "com.xyz.ClassName %>

// Tag Library References

<%@ taglib URI = "path to Taglib file" prefix = "xx" %>

// here xx refers to the prefix with which the tag library will be referred to

// HTML Head & Title Content

// Java Script Content

// HTML Body & Form Contents

Note: Java code can be placed within the <% %> tags in the body part of the JSP page within the Body tags.

As you can see, a JSP file is pretty straightforward. Also, an important point to note here is the fact that, not all of the entities mentioned above are mandatory. You can include or exclude any of the entities mentioned above, based on your requirement and convenience.

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How can i Write jsp page?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Can I prevent the creation of a session in a JSP page?

Yes you can. Use the below line in your JSP page to accomplish it. &lt;%@ page session="false" %&gt;


What are the Implicit object in JSP?

The implicit objects in a JSP page are:requestresponsepageContextsessionapplicationoutconfigpage


What are the JSP lifecycle methods?

The 3 life cycle methods in a JSP page are:jspInit() - Called when the JSP page is initializedjspService() - Called everytime a request/response is received/submittedjspDestroy() - Called when the JSP is no longer required


When you forward a JSP page which built-in JSP object goes out of scope?

application


Is it possible to include a doc file in a JSP page?

Yes. You can embed spreadsheets, pdfs and word documents in a JSP Page


How many page directive can use in a single JSP?

There is no limit as such. You can use one or more Page Directives in a JSP but you cannot have duplicates


How does a JSP page handle run-time exceptions?

You can use the errorPage attribute of the page directive. If this attribute is defined in a JSP page, when a run time exception is encountered, the control will be transferred to this JSP page. This error page can access details of the Exception from the request and use it to display a logical message to the user.


What is the purpose of page directive in JSP?

The Page Directive is one of the important components of any JSP Page. It can help us define page specific properties like Buffer size or location of an error page etc A JSP page, and any files included via the include directive, can contain one or more page directives but no duplicates. The JSP container will apply all the attributes to the page. The position of these page directives is irrelevant, but it is good practice to keep them together at the top of the page. (So that we can identify them easily)


How do you create master page in jsp?

how to create a master page in java


How do you get the image file from the database with JSP?

You can retrieve an image file from a database in JSP by writing a servlet that fetches the image from the database and streams it to the JSP page. The servlet will set the content type to &quot;image/jpeg&quot; or the appropriate image format and write the image data to the response output stream. In the JSP page, you can then display the image by setting the source attribute of the img tag to the servlet URL.


How you can display servlet page in jsp page?

You cannot. You display JSP Pages using the help of Servlets. Servlets are of the background classes and you cannot display them


Describe jsp processing?

JSPs are converted to servlets before the container runs them. This is actually cool because you don't need hardcore java programming skills to create a JSP page whereas you'll need them to write a servlet. Moreover, all you'll need to write a JSP is some expertise in creating HTML files and in using JavaScript. You can create front-end JSP pages without having much expertise in Java at all. Although JSP reduces the required skill level, JSP becomes a servlet, with the nice performance and portability benefits.