A P P E N D I X
C
Packaging JSP Pages
This appendix shows two simple examples of packaging a JSP page into a WAR for delivery 
into a Web container. In the first example, the JSP page is delivered in source form.  This is 
likely to be the most common example.  In the second example the JSP page is compiled into 
a Servlet that uses only Servlet 2.2 and JSP 1.1 API calls; the Servlet is then packaged into a 
WAR with a deployment descriptor such that it looks as the original JSP page to any client.
This appendix is non normative.  Actually, strictly speaking, the appendix relates more to the 
Servlet 2.2 capabilities to the JSP 1.1 capabilities.  The appendix is included here as this is a 
feature that JSP page authors and JSP page authoring tools are interested in.
C.1
A very simple JSP page
We start with a very simple JSP page 
HelloWorld.jsp
.
<%@ page info="Example JSP pre compiled" %>

Hello World

C.2
The JSP page packaged as source in a WAR 
file
The JSP page can be packaged into a WAR file by just placing it at location "
/
HelloWorld.jsp
" the default JSP page extension mapping will pick it up.  The 
web.xml
 is trivial:
146




JSP Web Hosting JavaServer Pages Specifications JSP Hosting




 
TotalRoute.net Business web hosting division of Vision Web Hosting Inc. All rights reserved.