Implicit Variables

The tags that you studied in the previous sections enable you to write Web applications that embed Java code in HTML files. But the tags on their own cannot suffice. Since JSP is compiled to a servlet, the JSP specification provides functionality equivalent to that found in Java servlets for processes such as request and response processing. Hence, implicit variables are defined in the JSP specification and are made available to any Java code written in the JSP page. These are actually objects defined and instantiated by the JSP engine. You do not need to explicitly instantiate these objects, and hence they are termed implicit variables.

Available Implicit Variables

The request implicit variable is an instantiation of the HttpServletRequest object. All parameters sent by the browser as request data can be accessed in the JSP using the request object. The request implicit variable has the same methods as the HttpServletRequest class.

The response implicit variable is an instantiation of the HttpServletResponse object. Any response that the JSP is required to generate for the browser is put in the response implicit variable. The response implicit variable has the same methods as the HttpServletResponse class.

The out implicit variable is the handle to write response data from the JSP to the browser. The out implicit variable is the instantiation of the output stream of the response object.

The session implicit variable is the handle to the HttpSession object of the user's current session. The session implicit variable has the same methods as the HttpSession class.

The following implicit variables are not frequently used. But this list is provided for your reference:

  • pageContext

  • application

  • config

  • page



Sams Teach Yourself BEA WebLogic Server 7. 0 in 21 Days
Sams Teach Yourself BEA WebLogic Server 7.0 in 21 Days
ISBN: 0672324334
EAN: 2147483647
Year: 2002
Pages: 339

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net