Re: how to write rewrite rule?

Splash Forums PrettyFaces Users how to write rewrite rule? Re: how to write rewrite rule?

#22002

dolphincn
Participant

I used netbeans 7.1 and tomcate 7 and mojarra jsf 2.1.

I have difined the rule like you desciption. but something set wrong at web.xml about jsf configuration that cause following error.

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

com.sun.faces.context.FacesFileNotFoundException: /admin/index.xhtml Not Found in ExternalContext as a Resource

com.sun.faces.facelets.impl.DefaultFaceletFactory.resolveURL(DefaultFaceletFactory.java:232)

com.sun.faces.facelets.impl.DefaultFaceletFactory.resolveURL(DefaultFaceletFactory.java:273)

com.sun.faces.facelets.impl.DefaultFaceletFactory.getMetadataFacelet(DefaultFaceletFactory.java:209)

com.sun.faces.application.view.ViewMetadataImpl.createMetadataView(ViewMetadataImpl.java:114)

com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:233)

com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)

com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)

com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)

javax.faces.webapp.FacesServlet.service(FacesServlet.java:409)

org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)

note The full stack trace of the root cause is available in the Apache Tomcat/7.0.22 logs.


<?xml version=”1.0″ encoding=”UTF-8″?>

<web-app xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”

xmlns=”http://java.sun.com/xml/ns/javaee”

xmlns:web=”http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd”

xsi:schemaLocation=”http://java.sun.com/xml/ns/javaee

http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd

id=”WebApp_ID” version=”2.5″>

<display-name>JavaServerFaces</display-name>

<!– JSF mapping –>

<servlet>

<servlet-name>Faces Servlet</servlet-name>

<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>

<load-on-startup>1</load-on-startup>

</servlet>

<!– ================<Facelets>====================================–>

<!– Use Documents Saved as *.xhtml –>

<context-param>

<param-name>javax.faces.DEFAULT_SUFFIX</param-name>

<param-value>.xhtml</param-value>

</context-param>

<!– ================</Facelets>===================================–>

<!– ======Faces Servlet Mapping ===================================–>

<servlet-mapping>

<servlet-name>Faces Servlet</servlet-name>

<url-pattern>*.xhtml</url-pattern>

</servlet-mapping>

<welcome-file-list>

<welcome-file>index.xhtml</welcome-file>

</welcome-file-list>

</web-app>


<pretty-config xmlns=”http://ocpsoft.com/prettyfaces/3.3.2″

xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”

xsi:schemaLocation=”http://ocpsoft.com/prettyfaces/3.3.2

http://ocpsoft.com/xml/ns/prettyfaces/ocpsoft-pretty-faces-3.3.2.xsd“>

<url-mapping>

<pattern value=”/” />

<view-id value=”/index.xhtml” />

</url-mapping>

<url-mapping>

<pattern value=”/admin” />

<view-id value=”/admin/admin.xhtml” />

</url-mapping>

</pretty-config>