|
Edit the web.xml file. |
![]() |
A separat directory should be created and used under ...webapps/ROOT for each new custom web application. |
![]() |
Create a new <servlet> block to create a new custom web application,
use the existing custom servlet as an example. |
![]() |
The jsppath parameter tells the servlet which directory under ...webapps/ROOT will contain the JSP pages. |
![]() |
The default JSP parameter tells the servlet which JSP page to call if none is specified. The default JSP must be in the directory referenced by jsppath. |
![]() |
The section <servlet-mapping> must reference the
text that will be used to name the servlet in the URL. For instance, this example would use the URL http://host:port/myapp/custom. It is important that the directory that contains the JSP (the jsppath parameter in the servlet section) must be different from the name referenced (myapp). One way to solve this is to name the directory with a prefix of JSP. In this case the directory would be named jspmyapp, and jspPath would have a value of jspmyapp. There needs to be a <servlet-mapping> section for each custom servlet that you create. For <servlet-mapping> you need to change the <url-pattern> to in this example myapp, and the <servlet-name> to the appropriate servlet. |
![]() |
You can create as many custom servlets as needed, just make sure the <servlet-name> parameter value is unique, and also make sure you create a <servlet-mapping> section for each custom servlet, and make sure the <servlet-mapping> definition and the <servlet-name> parameter value references the correct servlet. |