Java Reference
In-Depth Information
As we can see, this page is composed of both static HTML elements and JSP
expressions and scriptlets. As can be seen in the above screenshot, NetBeans
automatically highlights both JSP expressions and scriptlets, making it easy to
spot the dynamic parts of our JSP at a glance.
JSP expressions are enclosed in <%= and %> delimiters. Inside these delimiters we
can place any valid Java expression returning a value. The value is automatically
converted to a String and displayed on the page. To simplify expressions, JSPs
contain a number of implicit objects. One of these implicit objects is request , this
object contains the HTTP request that was generated when navigating to the page.
The first JSP expression on our output page uses the implicit request object. It is
used to retrieve the value of the request parameter named "fullName". Notice that
the String we passed to this method matches the name of the text input field used
to collect the user's full name in the previous page. When that page is submitted, a
request parameter is automatically generated with this name and the user entered
input as its value. Invoking this method allows us to retrieve the data that the user
entered.
Hitting Ctrl+space between <%= and %> or <% and %> delimiters results in all implicit
objects available to JSP pages being displayed.
The following table briefly describes all implicit JSP objects.
Implicit
Object
Implicit Object Type
Implicit Object Description
application javax.servlet.
ServletContext
This object can have attributes attached
that are visible across user sessions.
config
javax.servlet.
ServletConfig
Typically used to obtain initialization
parameters.
 
Search WWH ::




Custom Search