Java Reference
In-Depth Information
What are Implicit Objects?
As a JSP author, you have access to certain objects that are available for use in JSP documents
without being declared first. These objects are parsed by the JSP engine and inserted into the
generated servlet as if you defined them yourself.
In reality the JSP engine recognizes the implicit object names and knows that they will be
declared by, or passed into, the generated servlet. The following code is an example of a code
snippet containing a _jspService() method. As we continue with the rest of this chapter, we
will examine exactly where in this code each of the implicit objects is declared. We will also
look at examples, where applicable, of how you can use each one of these objects.
public void _jspService(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
JspFactory _jspxFactory = null;
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
String _value = null;
try {
if (_jspx_inited == false) {
_jspx_inited = true;
_jspxFactory = JspFactory.getDefaultFactory();
pageContext = _jspxFactory.getPageContext(this, request, response,
“errorpage.jsp”, true, 8192, true);
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
// begin
out.write(“\r\n\r\n<html>\r\n <head>\r\n <title>Hello “ +
“JSP</title>\r\n </head>\r\n <body>\r\n “);
Search WWH ::

Custom Search