Professional Documents
Culture Documents
A JSP page services requests as a servlet. Thus, the life cycle and many of the
capabilities of JSP pages (in particular the dynamic aspects) are determined by Java
Servlet technology. You will notice that many sections in this chapter refer to classes
and methods described in Chapter 11.
When a request is mapped to a JSP page, the web container first checks whether the
JSP page's servlet is older than the JSP page. If the servlet is older, the web container
translates the JSP page into a servlet class and compiles the class. During
development, one of the advantages of JSP pages over servlets is that the build process
is performed automatically.
Translation and Compilation
During the translation phase each type of data in a JSP page is treated differently. Static
data is transformed into code that will emit the data into the response stream. JSP
elements are treated as follows:
Directives are used to control how the web container translates and executes the JSP
page.
Scripting elements are inserted into the JSP page's servlet class. See Chapter 16 for
details.
Expression language expressions are passed as parameters to calls to the JSP
expression evaluator.
jsp:[set|get]Property elements are converted into method calls to JavaBeans
components.
jsp:[include|forward] elements are converted into invocations of the Java Servlet API.
The jsp:plugin element is converted into browser-specific markup for activating an
applet.
Custom tags are converted into calls to the tag handler that implements the custom tag.
page deals with the jsp page. Once the page has send back the response back to the
browser or once it forward the request to another resource the page will die.
The same thing also applies for pageContext where pageContext have more features
like set & get, forward,include,etc since it actaully extends JspContext class.
This much i know. Can u give me an example for page implicit object??
A PageContext instance provides access to all the namespaces associated with a JSP
page, provides access to several page attributes, as well as a layer above the
implementation details
It provides
a single API to manage the various scoped namespaces
a number of convenience API's to access various public objects
a mechanism to obtain the JspWriter for output
a mechanism to manage session usage by the page
a mechanism to expose page directive attributes to the scripting environment
mechanisms to forward or include the current request to other active components in the
JSP is Java code embedded in HTML; the Java code is compiled (if necessary) and run
by the container on the server and the client only sees the results of that code's
execution mixed in appropriately with the html.
Servlets are compiled pure Java class files (not mixed with HTML) that get posts from
the client and send html to in return.
Both require a container on the server, such as Tomcat, which provides the environment
and VM for the Java program. Download Tomcat from http://jakarta.apache.org/tomcat/
-- it has samples of both.
intitally jspwriter depends on printwriter But the thing diffrence is that if you want the
page is buffered in such cases you can use jspwriter becuase it has the lof of buffering
capabilities rather than printwriter.
eds