HP Integrity NonStop J-Series User Manual

Page 85

Advertising
background image

1.

Double-click the EmpInfo/WebContent/WEB-INF/web.xml file in the Project Explorer
frame to open it.

NOTE:

By default, XML files open in the XML Editor. The XML Editor has two views: Design

and Source view. Select the Source view.

2.

Open the EmpInfo/WebContent/WEB-INF/web.xml file.

The template for the default web.xml file generated during project creation is:

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>
EmpInfo</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>

3.

Set the index.jsp file as <welcome-file> by deleting other files from
<welcome-file-list>.

4.

Set the class for the DispatcherServlet of the EmpInfo application in the web.xml file
as shown below:

<servlet>
<servlet-name>EmpInfo</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

5.

Specify the URL pattern as *.htm in the <servlet-mapping> tag as shown below:

<servlet-mapping>
<servlet-name>EmpInfo</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>

NOTE:

This servlet definition maps to the application patterns. Any URL with the .htm

extension is routed to the EmpInfo servlet (the DispatcherServlet).

After modification, the web.xml file appears as:

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>
EmpInfo</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>EmpInfo</servlet-name>

Overview of EmpInfo

85

Advertising
This manual is related to the following products: