I need to integrate pretty faces with my jsf 2.0, primefaces application, but its giving some troubles.
As mentioned in the getting started i placed following in my web.xml, added the required jar in the lib folder
<filter>
<filter-name>Pretty Filter</filter-name>
<filter-class>com.ocpsoft.pretty.PrettyFilter</filter-class>
<async-supported>true</async-supported>
</filter>
<filter-mapping>
<filter-name>Pretty Filter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
<dispatcher>ERROR</dispatcher>
</filter-mapping>
other items in my web.xml
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<context-param>
<param-name>com.sun.faces.expressionFactory</param-name>
<param-value>org.jboss.el.ExpressionFactoryImpl</param-value>
</context-param>
<context-param>
<param-name>org.primefaces.extensions.DELIVER_UNCOMPRESSED_RESOURCES</param-name>
<param-value>false</param-value>
</context-param>
But i am getting following Error:
Invalid content was found starting with element 'async-supported'. One of '{"http://java.sun.com/xml/ns/javaee":init-param}' is expected
If i remove <async-supported> from the project builds, project compiles but the mapping doesnt work.
pretty-config.xml is same as in the getting started.
Do i need to mention in my web.xml the name/path of the mapping file i.e pretty-config.xml?
EDIT:
I am using Glassfish server 3.
It is very important to check the
versionattribute you are using in yourweb.xml. If you haveversion="2.5"set, you have to add this to your web.xml:Please not that
<async-supported>true</async-supported>is NOT set here, because it is only supported in Servlet 3.0.If you have
version="3.0"set in your web.xml, you don’t have to add anything to your web.xml. In this case PrettyFaces automatically registers the filter using theweb-fragment.xmlthat is included inprettyfaces-jsf2.jar.You don’t have to specify the location of
pretty-config.xmlanywhere. Just place it in yourWEB-INFfolder and PrettyFaces will find it.You should also add one mapping to your
pretty-config.xml, so you can check if everything works correctly. If you have for example a page that you typically access using an URL like:Then you can add this mapping:
Now you should be able to access the page using this link: