Wednesday, June 3, 2015

JavaServer Page

JavaServer Pages, or JSP, is a technology that allows developers to generate HTML and XML in response to a web client request.

JSP allows Java code and various predefined actions to be embedded into static content. JSP actions are additional XML tags that help extend the capabilities of a Web server.

The main features of JSP:

1. A language for developing JSP pages, which are text-based documents that describe how to process a request and construct a response.
2. An expression language for accessing server-side objects.
3. Mechanisms for defining extensions to the JSP language
.
Descriptions:

Jsp is a text-based Document which is used to create the dynamic web contents. and it is the extensions of Servlet.

Basically, JSPs are HTML files with embedded Java servlet code.

Each block of servlet code is surrounded by a leading '<%' tag and a closing %> tag.

Similar to servlets, they can do much more complicated work based on data submitted by the client.

To make the manipulation convenient, a scriptlet can use a number of predefined variables.

The six most frequently used variables are:

1. HttpServletRequest request --- The Servlet Request

2. HttpServletResponse response --- Servlet Response

3. javax.servlet.jsp.JspWriter out --- like a PrintWriter

4. HttpSession session --- User session

5. ServletContext application --- The Web application

6. javax.servlet.jsp.PageContext pageContext --- share the variables between jsp pages and supporting beans, tags

JSP may include the servlet code in the following formats.

i. Expressions
ii. Declarations
iii. Scriptlets
iv. Directives

No comments: