Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 3: JavaServer Pages > Implicit Objects

Implicit Objects

The servlet container passes several objects to the servlets it is running. For instance, you get an HttpServletRequest and an HttpServletResponse in the servlet's service method and a ServletConfig in the init method. In addition, you can obtain an HttpSession by calling getSession on the HttpServletRequest object.

In JSP you can retrieve those objects by using implicit objects. Table 3.1 lists the implicit objects.

For example, the request implicit object represents the HttpServletRequest passed by the servlet/JSP container to the servlet's service method. You can use request as if it was a variable reference to the HttpServletRequest. For instance, the following code retrieves the userName parameter from the HttpServletRequest object.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial