Re: The FacesServlet cannot have a url-pattern of /*

Splash Forums PrettyFaces Users The FacesServlet cannot have a url-pattern of /* Re: The FacesServlet cannot have a url-pattern of /*

#20617

Last
Participant

I have problems to map any resources with this kind of errors. If I keep the pattern to /*, from this source code in index.xhtml:

<h:head>
<title>Facelet Title</title>
<h:outputStylesheet library="css" name="reset.css"/>
<h:outputStylesheet library="css" name="screen.css"/>
</h:head>

I get this:

<head>
<title>Facelet Title</title>
<link type="text/css" rel="stylesheet" href="/gowalla-war/*/javax.faces.resource/reset.css?ln=css" />
<link type="text/css" rel="stylesheet" href="/gowalla-war/*/javax.faces.resource/screen.css?ln=css" />
</head>

(notice the /*/ part in the path). If I access that URL, I get that error from the thread subject (The FacesServlet cannot have a url-pattern of /*).

How should my web.xml look? It looks like this now:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<param-name>com.ocpsoft.pretty.BASE_PACKAGES</param-name>
<param-value>cz.cvut.x33eja.gowalla,com.ocpsoft</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>

If I try to change the url-pattern to, for example, /faces/* and hit the Run button in netbeans, the source code is not parsed at all – I get the HTML with all the <h:…> tags in the browser.

I really don’t what the pattern should be set to, even after reading the documentation.

Thanks.