如何在 dataList 项目链接中使用 PrettyFaces?
<p:dataList value="#{mybean.cities}" var="city">
<h:link outcome="pretty:goCity">
TEXT
<f:param name="city" value="#{city.city}" />
<f:param name="cityId" value="#{city.id}" />
</h:link>
</p:dataList>
这是我的漂亮配置:
<url-mapping id="goCity">
<pattern value="/#{cityId:city.id}/#{city:city.city}" />
<view-id value="/page.xhtml" />
</url-mapping>
我收到了这个错误:
com.ocpsoft.pretty.PrettyException: PrettyFaces: Exception occurred while processing <goCity:#{city.id}> for URL </144/London>
com.ocpsoft.pretty.faces.beans.ParameterInjector.injectPathParams(ParameterInjector.java:96)
com.ocpsoft.pretty.faces.beans.ParameterInjector.injectParameters(ParameterInjector.java:54)
com.ocpsoft.pretty.faces.event.PrettyPhaseListener.afterPhase(PrettyPhaseListener.java:98)
com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:189)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:107)
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:593)
com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:118)
com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:110)
javax.el.PropertyNotFoundException: Target Unreachable, identifier 'city' resolved to null
org.apache.el.parser.AstValue.getTarget(AstValue.java:98)
org.apache.el.parser.AstValue.getType(AstValue.java:82)
org.apache.el.ValueExpressionImpl.getType(ValueExpressionImpl.java:176)
com.ocpsoft.pretty.faces.util.FacesElUtils.getExpectedType(FacesElUtils.java:50)
com.ocpsoft.pretty.faces.beans.ParameterInjector.injectPathParams(ParameterInjector.java:79)
com.ocpsoft.pretty.faces.beans.ParameterInjector.injectParameters(ParameterInjector.java:54)
com.ocpsoft.pretty.faces.event.PrettyPhaseListener.afterPhase(PrettyPhaseListener.java:98)
com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:189)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:107)
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:593)
com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:118)
com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:110)