Java Reference
In-Depth Information
The ServletResponse object allows you to set response parameters such as content type. You can
also get an OutputStream from the response object for binary writes.
out
The out object is the instance of JspWriter used to write output to the client. The ability to access the
JspWriter directly allows you to send output directly from a scriptlet.
session
The session object is an instance of HttpSession. It encapsulates session information in the form of
objects that can be written and read by beans or JSP pages within the session scope.
application
The application object is an instance of the ServletContext object.
pageContext
The pageContext object is the general point of access for most of the built-in objects; for example, to get
the session object, you can call:
HttpSession session = pageContext.getSession();
page
The page object is a reference to the current page.
exception
The exception object is used by an error page to access the exception that causes the error page to be
displayed.
Automatic Type Conversion
Clearly, when you create a JavaBean, you may want to use property variables of various types, such as
integers and doubles . The values of the request parameters sent from the client to the server are
always of type String . These values are converted to other data types automatically, using the
appropriate valueOf(String) expression .
valueOf(String)
JSP's automatic type conversion uses the methods listed in Table 12-2 to perform conversions.
Table 12-2: Automatic Type Conversions Supported by JSP
Data Type
Conversion Method
boolean or Boolean
java.lang.Boolean.valueOf(String)
byte or Byte
java.lang.Byte.valueOf(String)
char or Character,
java.lang.Character.valueOf(String)
int or Integer
java.lang.Integer.valueOf(String)
double or Double
java.lang.Double.valueOf(String)
integer or Integer
java.lang.Integer.valueOf(String)
float or Float
java.lang.Float.valueOf(String)
long or Long
java.lang.Long.valueOf(String)
Search WWH ::




Custom Search