[ Team LiB ] Previous Section Next Section


The Workshop is designed to help you review what you have learned, and help you to further increase your understanding of the material covered in this hour.



Which packages are imported by default?


What are the three ways that you can structure page directives to import several packages?


Which implicit objects depend on page directives to make them available for use?



A JSP container automatically imports java.lang.*, javax.servlet.*, javax.servlet.jsp.*, and javax.servlet.http.*. If you require packages other than these, you'll need to explicitly import them using one or more page directives.


page directives that import packages can have the following forms:

  • <%@ page import="java.sql.*" %>
    <%@ page import="java.util.*" %>
  • <%@ page import="java.sql.*" import="java.util.*" %>

  • <%@ page import="java.sql.*,java.util.*" %>

The particular form that you use will depend on personal preference, but the first form is usually best. For additional help with style choices in JSPs, see http://developer.java.sun.com/developer/technicalArticles/javaserverpages/code_convention/.


The implicit object exception is available only when you declare that isErrorPage=true. The implicit object session is available when session=true—however, by default session is true.


Write a JSP that outputs a large amount of text and another that acts as an error page. Turn autoFlush off and change the values for the buffer size until you get an exception. Turn autoFlush back on. Observe the behavior and explain it.

    [ Team LiB ] Previous Section Next Section