Modifying the web.xml file – HP Integrity NonStop H-Series User Manual

Page 441

Advertising
background image

Removing the Folders and Files from the EmpInfo Application

Remove the following folders and files from the EmpInfo application:

jsp folder in

EmpInfo/WebContent/WEB-INF

.

EmpInfo-servlet.xml

file in

EmpInfo/WebContent/WEB-INF

.

EmployeeController.java

in

EmpInfo/src/com/hp/empinfo/web

.

Modifying the

web.xml

File

Modify the

web.xml

file to set the Faces servlet and its mapping.

To modify the

web.xml

file, complete the following steps:

1.

Configure

WebApplicationContext

to use the Spring

ContextLoaderServlet

. To do

so, add the following code in the

web.xml

file:

<servlet>
<servlet-name>context</servlet-name>
<servlet-class>
org.springframework.web.context.ContextLoaderServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

2.

Set the class for the Faces Controller servlet of the EmpInfo application by adding the
following code in the

web.xml

file.

<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

This ensures that the

web.xml

file has a Faces servlet entry

(

javax.faces.webapp.FacesServlet

), which serves as a Faces Controller servlet.

NOTE:

The Faces Controller servlet intercepts all Faces requests.

3.

Specify the URL pattern as

*.jsf

in the

<servlet-mapping/> tag

as shown below:

<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>

NOTE:

This servlet mapping definition is for mapping the URL patterns. It ensures that

any URL with the

.jsf

extension is routed to the Faces Servlet (the Faces Controller servlet).

4.

Set the extension filter by adding the following code:

<filter>
<filter-name>extensionsFilter</filter-name>
<filter-class>
org.apache.myfaces.component.html.util.ExtensionsFilter
</filter-class>
<init-param>
<param-name>uploadMaxFileSize</param-name>
<param-value>100m</param-value>
</init-param>
<init-param>
<param-name>uploadThresholdSize</param-name>
<param-value>100k</param-value>

Example of Integrating MyFaces into Spring

441

Advertising
This manual is related to the following products: