Servlet Deployment

For the servlet example there are the following additional sources:

We have used the following directory layout for the Java sources (Data.java), the JSP HTML form (form.jsp) and the web application configuration file (web.xml). We also reuse some arte-facts from the previous terminal example, but we do not show them here:

example01
example04
+--- Data.java
+--- form.jsp
WEB-INF
+--- web.xml

The compilation is done similar as for the previous terminal, standalone or applet example, and we do not show it here. Once again we assume that all the artefacts are packed into an archive (hello.jar). This can be done for example by the jar command:

jar cf WEB-INF/lib/hello.jar \
WEB-INF/classes/*.class \
WEB-INF/classes/*.p

There is no need to compile the JSP HTML form. It will be automatically transformed and compiled when invoked. The JSP HTML form will be placed on the web server together with the archives and the web application configuration file (web.xml):

example04
+--- form.jsp
WEB-INF
+---lib
| +--- interpreter.jar
| +--- hello.jar
+--- web.xml

There are different approaches to deploy a web context to a web server. We find creating a .war file or plain copying of the directory tree. When the start of the web server was successful the JSP HTML form can be invoked from a browser.

Comments