Not a PrettyFaces navigation string – passing control to default nav-handler

Splash Forums PrettyFaces Users Not a PrettyFaces navigation string – passing control to default nav-handler

This topic contains 14 replies, has 2 voices, and was last updated by  Christian Kaltepoth 10 years, 3 months ago.

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #18048

    mika
    Participant

    hi

    i have a link:

    <h:commandLink value="#{u.name}" action="/editUser?faces-redirect=true">

    when i click on it, i am getting the error in the jsf page:

    Unable to find matching navigation case with from-view-id '/viewUsers.xhtml' for action 'addUser?faces-redirect=true' with outcome 'addUser?faces-redirect=true'

    and the debugs are:

    DEBUG [http-bio-8080-exec-3] (PrettyNavigationHandler.java:56) - Navigation requested: fromAction [addUser?faces-redirect=true], outcome [addUser?faces-redirect=true]
    DEBUG [http-bio-8080-exec-3] (PrettyNavigationHandler.java:59) - Not a PrettyFaces navigation string - passing control to default nav-handler

    please advise.

    #21528

    mika
    Participant

    well it worked after removing faces-redirect=true, and use prettyFaces navigation

    <h:commandLink value="#{u.name}" action="pretty:editUser">
    <f:setPropertyActionListener target="#{user.editUser}" value="true"/>
    </h:commandLink>

    but the issue is that the property is not set, any ideas ?

    #21529

    Could you post the corresponding mapping please?

    #21530

    mika
    Participant

    here it is:

    @URLMappings(mappings = {

    @URLMapping(id = “viewUsers”, pattern = “/viewUsers”, viewId = “/faces/viewUsers.xhtml”),

    @URLMapping(id = “addUser”, pattern = “/addUser”, viewId = “/faces/addUser.xhtml”),

    @URLMapping(id = “editUser”, pattern = “/editUser”, viewId = “/faces/addUser.xhtml”) })

    BTW, i edited above post, i meant that the bean property is not set.

    #21531

    Which bean property do you refer to? #{user.editUser}? Is it declared as a query parameter or something like that? If not, setting the value this way won’t work if you set it on a request-scoped bean because it won’t survive the redirect.

    #21532

    mika
    Participant

    yes i am setting the property user.editUser, and my scope is view scope, what do you suggest to solve this issue ?

    and is pretty: always makes redirection ?

    #21533

    mika
    Participant

    ok i changed my declaration to:

    @URLMapping(id = "editUser", pattern = "/editUser/#{ id: user.userId}", viewId = "/faces/addUser.xhtml")

    and used prettyLink

    <pretty:link mappingId=”editUser”>

    <f:param value=”#{u.id}”/>

    #{u.name}

    </pretty:link>`

    but when i tried to go to a url like:

    http://localhost:8080/myapp/editUser/1

    i got an exception:

    com.ocpsoft.pretty.PrettyException: PrettyFaces: Exception occurred while processing <editUser:#{user.userId}> for URL </editUser/1>
    at com.ocpsoft.pretty.faces.beans.ParameterInjector.injectPathParams(ParameterInjector.java:96)
    at com.ocpsoft.pretty.faces.beans.ParameterInjector.injectParameters(ParameterInjector.java:54)
    at com.ocpsoft.pretty.faces.event.PrettyPhaseListener.afterPhase(PrettyPhaseListener.java:98)
    at com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:189)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:107)
    at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:118)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:99)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:119)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:177)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:57)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:169)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:471)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:402)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:329)
    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:110)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:112)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:177)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:169)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:964)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:619)
    Caused by: javax.el.PropertyNotFoundException: Property 'userId' not found on type com.spring.sample.beans.UserBean
    at javax.el.BeanELResolver$BeanProperties.get(BeanELResolver.java:223)
    at javax.el.BeanELResolver$BeanProperties.access$400(BeanELResolver.java:200)
    at javax.el.BeanELResolver.property(BeanELResolver.java:311)
    at javax.el.BeanELResolver.getType(BeanELResolver.java:110)
    at com.sun.faces.el.DemuxCompositeELResolver._getType(DemuxCompositeELResolver.java:215)
    at com.sun.faces.el.DemuxCompositeELResolver.getType(DemuxCompositeELResolver.java:242)
    at org.apache.el.parser.AstValue.getType(AstValue.java:84)
    at org.apache.el.ValueExpressionImpl.getType(ValueExpressionImpl.java:176)
    at com.ocpsoft.pretty.faces.util.FacesElUtils.getExpectedType(FacesElUtils.java:50)
    at com.ocpsoft.pretty.faces.beans.ParameterInjector.injectPathParams(ParameterInjector.java:79)
    ... 87 more

    please advise.

    #21534

    mika
    Participant

    @Christian any help here ?

    #21535

    Do you have getters and setters for the property userId? They have to be named getUserId() and setUserId()!

    #21536

    mika
    Participant

    yes,sure.

    #21537

    Is your bean perhaps proxied by Spring or something like this? Is there something like Spring’s @Transactional on the class? Or is it an AOP-scoped-proxy?

    Actually this exception isn’t caused by PrettyFaces. It seems like the property isn’t accessible via EL expressions. So there seems to be something wrong here.

    #21538

    mika
    Participant

    oh, sorry, i was mistaken the field was user.userID not user.userId, sorry, it works fine now, but another question is how to define query parameter via annotation not via xml in this link:

    http://ocpsoft.com/docs/prettyfaces/3.2.0/en-US/html/Configuration.html#config.queryparams

    coz i want to accomplish something like what you mentioned here in your comment:

    http://ocpsoft.com/support/topic/prettylink-and-query-parameter

    please advise.

    #21539

    How to configure PrettyFaces via annotations is described in a separate chapter of the documentation:

    http://ocpsoft.com/docs/prettyfaces/3.2.0/en-US/html/Configuration.html#config.annotations

    Query parameters are described here:

    http://ocpsoft.com/docs/prettyfaces/3.2.0/en-US/html/Configuration.html#config.annotations.queryparams

    #21540

    mika
    Participant

    @Christian thanks a lot man

    one more question, what will the link look like if i added query parameter

    /editUser?id=10 or what ?

    and the way i was using is called path parameter, right ?

    @URLMapping(id = “editUser”, pattern = “/editUser/#{ id: user.userId}”, viewId = “/faces/addUser.xhtml”)

    sorry for my beginner question, but i am a newbie to web development.

    #21541

    Yes, a query parameter added to the mapping will look exactly like this.

    And yes, you are using a path parameter for the userId property.

    :)

Viewing 15 posts - 1 through 15 (of 15 total)

The forum ‘PrettyFaces Users’ is closed to new topics and replies.

Comments are closed.