Modifying the web.xml file, Adding dependency jar files, Modifying the – HP Integrity NonStop H-Series User Manual

Page 127: Web.xml, File

Advertising
background image

Modifying the

web.xml

File

To modify the

web.xml

in the

EmpInfo/WebContent/

directory, complete the following

steps:

NOTE:

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

and Source view. Select the Source view.

1.

Add

ContextLoaderListener

to load the

applicationContext.xml

file under the

<web-app>

tag:

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>

2.

Increase the startup load to 2 after adding the

ContextLoaderListener

to make

DispatcherServlet

as the secondary servlet class. The

ContextLoaderListener

servlet class becomes the primary servlet class.

After modification, the

web.xml

file must appear 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>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>EmpInfo</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>

<listener>

<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
</web-app>

Adding Dependency JAR Files

Add the following dependency JAR files to the EmpInfo project library.

Overview of EmpInfo

127

Advertising
This manual is related to the following products: