Java Reference
In-Depth Information
scriptlet
HTML output
only if user is
admin
scriptlet
FIGURE 12-76
The JSP is complete. It is not compiled at this time. The JSP container will
create the corresponding servlet code and compile it when the JSP is first loaded.
Testing Servlets and JavaServer Pages
To test a servlet, it first must be compiled and then the resulting class file must be
placed in an appropriate location on the Web server. HTML files and JSP files also
must be copied to their respective locations on the Web server. The Web server
must be started, including the JSP and servlet containers, then a Web browser
can be used to load the initial Web page for the Web application. For this project,
Tomcat provides the servlet container, JSP container, and Web server.
Before using the servlet, JSPs, and HTML documents, two issues with
Tomcat must be addressed: deployment descriptors and servlet reloading. The
following sections address these two issues.
Modifying a Deployment Descriptor
Web applications typically are distributed within their own packages. For
simplicity, this text used the default package. With Tomcat, classes in the default
package are not accessible within JSPs. In a similar fashion, servlet classes placed
in the default servlet folder, as opposed to files mapped to a specific package for
 
Search WWH ::




Custom Search