[an error occurred while processing this directive]

Creating configuration files

                          

    For the application, we need two files in WEB-INF folder of the application in Tomcat.

  1. web.xml and 
  2. faces-config.xml file

    Make sure you have these two otherwise you need to create them.

 

 

 

1. web.xml file should look like:

 

<?xml version="1.0" encoding="UTF-8"?>
<web-app 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">
..............................
..............................
..............................
</web-app>

Editing web.xml file:
JSF application needs FacesServlet to be defined in web.xml. FacesServlet handles all JSF requests, builds component tree of the JSP page, creating Event Objects and passing to the registered listener etc. All requests must be directed to this servlet. For this reason FacesServlet is mapped in the web.xml. After editing, full web.xml file will be as below:

web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app 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>a4jEchoText</display-name>
<context-param>
<param-name>org.richfaces.SKIN</param-name>
<param-value>blueSky</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>

<filter>
<display-name>RichFaces Filter</display-name>
<filter-name>richfaces</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
</filter>
<filter-mapping>
<filter-name>richfaces</filter-name>
<servlet-name>Faces Servlet</servlet-name>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>

<filter>
<display-name>Ajax4jsf Filter</display-name>
<filter-name>ajax4jsf</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
</filter>
<filter-mapping>
<filter-name>ajax4jsf</filter-name>
<servlet-name>Faces Servlet</servlet-name>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>

<init-param>
<param-name>createTempFiles</param-name> 
<param-value>false</param-value>
</init-param>

<init-param>
<param-name>maxRequestSize</param-name>
<param-value>20000000</param-value> 
</init-param> 

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

<!-- Faces Servlet Mapping -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
</web-app>

 

2. faces-config.xml file should look like:

faces-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces
Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>
.........................
.........................
.........................
</faces-config>

This file will be edited in the later steps to define managed beans and navigation rules for the pages. You can get full faces-config.xml file in the Registering managed bean and defining navigation rules step of the tutorial.

                          

[an error occurred while processing this directive]