Dynamic view ID not working.

Splash Forums PrettyFaces Users Dynamic view ID not working.

This topic contains 16 replies, has 3 voices, and was last updated by  Peter-TI 1 year, 2 months ago.

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

    Peter-TI
    Participant

    Hello,

    Just for experimenting with Prettyfaces I have the following code.

    @ManagedBean
    @Named("login")
    @RequestScoped
    public class LoginBean implements Serializable{
        private String page;
        private String login;
        
        public void setPage(String page){
            this.page=page;
        }
        public String getPage(){
            return page;
        }
        public void setLogin(String login){
            this.login=login;
        }
        
        public String getLogin(){
            return "/specifications/noordzij-it/backend/pages/business/index.xhtml";
        }
        
    }

    pretty-config.xml

    
     <url-mapping id="masterPage">
    		<pattern value="/admin" />
    		<view-id value="#{loginBean.login}" />
            </url-mapping>
    

    In another index.xhtml file I have “#{loginBean.login}” and it returns the path as it should.So the bean works fine.
    After removing the bean and filling in the path manually, it works.

    But i just can’t get the dynamic id working.
    Have been trying for hours. Please help!

    Thanks in advance!

    • This topic was modified 1 year, 4 months ago by  Peter-TI.
    • This topic was modified 1 year, 4 months ago by  Peter-TI.
    #27053

    Could you show which dependencies you included in your project?
    And could you also post the import statements from LoginBean? You are using @ManagedBean and @Named. That looks weird. Are you using JSF beans or CDI beans?

    #27055

    Peter-TI
    Participant

    Hi Christian,

    The dependencies are:

    
    <dependencies>
            <dependency>
                <groupId>javax</groupId>
                <artifactId>javaee-web-api</artifactId>
                <version>7.0</version>
                <scope>provided</scope>
            </dependency>
            <!--Pretty Faces-->
            <dependency>
                <groupId>org.ocpsoft.rewrite</groupId>
                <artifactId>rewrite-servlet</artifactId>
                <version>2.0.12.Final</version>
            </dependency>
            
            <dependency>
                <groupId>org.ocpsoft.rewrite</groupId>
                <artifactId>rewrite-config-prettyfaces</artifactId>
                <version>2.0.12.Final</version>
            </dependency>
            
        </dependencies>
    
    

    The import statements in LoginBean are:

    
    import java.io.Serializable;
    import javax.faces.bean.ManagedBean;
    import javax.faces.bean.RequestScoped;
    import javax.inject.Named;
    

    I was using @ManagedBean and @Named becuase of an example in a book (Core JavaServer Faces).It was actually ment as a conjunction,I guess :S.
    This is my first Java EE project.:)

    I Guess @Named is a CDI bean and @ManagedBean is a JSF bean.
    This is probably my mistake I gues i would rather use @Named?

    Thank you.

    #27056

    Could you try adding:

    <dependency>
      <groupId>org.ocpsoft.rewrite</groupId>
      <artifactId>rewrite-integration-faces</artifactId>
      <version>2.0.12.Final</version>
    </dependency>
    
    #27064

    Peter-TI
    Participant

    Reply working

    #27066

    Peter-TI
    Participant

    I have a problem posting.
    I couldn’t post my situation overview.
    The forum keeps on telling my reply is empty.

    #27067

    Peter-TI
    Participant

    I attached the post.

    Attachments:
    1. post.docx
    #27069

    Is the getLogin() actually called? You could check with your debugger or a log statement.

    #27075

    Peter-TI
    Participant

    I’m sorry for my late response, little emergency.

    The method is called and works succesfully from any xhtml page.
    When the method is called from pretty-config.xml I get:

    
    Warning:   JSF1087: Unable to generate Facelets error page as the response has already been committed.
    Severe:   javax.faces.FacesException: Could not forward to view: #{loginBean.login}
    javax.faces.FacesException: Could not forward to view: #{loginBean.login}
    	at com.sun.faces.context.ExceptionHandlerImpl.handle(ExceptionHandlerImpl.java:141)
    	at javax.faces.context.ExceptionHandlerWrapper.handle(ExceptionHandlerWrapper.java:100)
    	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:119)
    	at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:121)
    	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
    	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
    	at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:344)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
    	at org.ocpsoft.rewrite.servlet.RewriteFilter.doFilter(RewriteFilter.java:205)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
    	at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:873)
    	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:739)
    	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:575)
    	at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:546)
    	at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:428)
    	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:378)
    	at org.ocpsoft.rewrite.servlet.impl.HttpRewriteResultHandler.handleResult(HttpRewriteResultHandler.java:41)
    	at org.ocpsoft.rewrite.servlet.RewriteFilter.rewrite(RewriteFilter.java:268)
    	at org.ocpsoft.rewrite.servlet.RewriteFilter.doFilter(RewriteFilter.java:188)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:316)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
    	at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
    	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
    	at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
    	at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:415)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:282)
    	at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
    	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
    	at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201)
    	at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
    	at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
    	at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
    	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
    	at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
    	at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
    	at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    	at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
    	at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
    	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
    	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
    	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
    	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
    	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
    	at java.lang.Thread.run(Thread.java:745)
    Caused by: com.ocpsoft.pretty.PrettyException: Could not forward to view: #{loginBean.login}
    	at com.ocpsoft.pretty.faces.config.dynaview.DynaviewEngine.processDynaView(DynaviewEngine.java:110)
    	at com.ocpsoft.pretty.faces.event.PrettyPhaseListener.afterPhase(PrettyPhaseListener.java:109)
    	at com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:189)
    	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:107)
    	... 47 more
    Caused by: javax.el.MethodNotFoundException: Method not found: navigation.LoginBean@31dee7c8.login()
    	at com.sun.el.util.ReflectionUtil.getMethod(ReflectionUtil.java:160)
    	at com.sun.el.parser.AstValue.invoke(AstValue.java:286)
    	at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:304)
    	at com.ocpsoft.pretty.faces.util.FacesElUtils.invokeMethod(FacesElUtils.java:70)
    	at com.ocpsoft.pretty.faces.util.FacesElUtils.invokeMethod(FacesElUtils.java:62)
    	at com.ocpsoft.pretty.faces.config.dynaview.DynaviewEngine.calculateDynaviewId(DynaviewEngine.java:150)
    	at com.ocpsoft.pretty.faces.config.dynaview.DynaviewEngine.computeDynaViewId(DynaviewEngine.java:133)
    	at com.ocpsoft.pretty.faces.config.dynaview.DynaviewEngine.processDynaView(DynaviewEngine.java:95)
    	... 50 more
    
    FATAL:   JSF1072: com.ocpsoft.pretty.PrettyException caught during afterPhase() processing of RESTORE_VIEW 1 : UIComponent-ClientId=, Message=Could not forward to view: #{loginBean.login}
    FATAL:   Could not forward to view: #{loginBean.login}
    com.ocpsoft.pretty.PrettyException: Could not forward to view: #{loginBean.login}
    	at com.ocpsoft.pretty.faces.config.dynaview.DynaviewEngine.processDynaView(DynaviewEngine.java:110)
    	at com.ocpsoft.pretty.faces.event.PrettyPhaseListener.afterPhase(PrettyPhaseListener.java:109)
    	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:121)
    	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
    	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
    	at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:344)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
    	at org.ocpsoft.rewrite.servlet.RewriteFilter.doFilter(RewriteFilter.java:205)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
    	at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:873)
    	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:739)
    	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:575)
    	at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:546)
    	at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:428)
    	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:378)
    	at org.ocpsoft.rewrite.servlet.impl.HttpRewriteResultHandler.handleResult(HttpRewriteResultHandler.java:41)
    	at org.ocpsoft.rewrite.servlet.RewriteFilter.rewrite(RewriteFilter.java:268)
    	at org.ocpsoft.rewrite.servlet.RewriteFilter.doFilter(RewriteFilter.java:188)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:316)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
    	at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
    	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
    	at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
    	at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:415)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:282)
    	at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
    	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
    	at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201)
    	at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
    	at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
    	at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
    	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
    	at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
    	at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
    	at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    	at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
    	at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
    	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
    	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
    	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
    	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
    	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
    	at java.lang.Thread.run(Thread.java:745)
    Caused by: javax.el.MethodNotFoundException: Method not found: navigation.LoginBean@31dee7c8.login()
    	at com.sun.el.util.ReflectionUtil.getMethod(ReflectionUtil.java:160)
    	at com.sun.el.parser.AstValue.invoke(AstValue.java:286)
    	at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:304)
    	at com.ocpsoft.pretty.faces.util.FacesElUtils.invokeMethod(FacesElUtils.java:70)
    	at com.ocpsoft.pretty.faces.util.FacesElUtils.invokeMethod(FacesElUtils.java:62)
    	at com.ocpsoft.pretty.faces.config.dynaview.DynaviewEngine.calculateDynaviewId(DynaviewEngine.java:150)
    	at com.ocpsoft.pretty.faces.config.dynaview.DynaviewEngine.computeDynaViewId(DynaviewEngine.java:133)
    	at com.ocpsoft.pretty.faces.config.dynaview.DynaviewEngine.processDynaView(DynaviewEngine.java:95)
    	... 50 more
    

    It’s working ! This with just calling:
    #{loginBean.getLogin} instead of #{loginBean.login} which does work in the xhtml pages.
    The reason why it took same time is becuase:
    #{loginBean.getLogin} does not work in the xhtml pages and #{loginBean.login} does.

    Thanks for you’re help Christian!

    • This reply was modified 1 year, 3 months ago by  Peter-TI.
    • This reply was modified 1 year, 3 months ago by  Peter-TI.
    #27078

    Peter-TI
    Participant

    Now that I have this working succesfully:

    
    <url-mapping id="home">
    		<pattern value="/" />
    		<view-id value="#{loginBean.getLogin}" />
    </url-mapping>
    

    I haven’t got this working:

    
     <url-mapping id="contact">
    		<pattern value="/#{pageBean.getPage}" />
    		<view-id value="/specifications/noordzij-it/frontend/pages/contact.xhtml" />
    </url-mapping>
    

    Just another “Test” bean:

    
    /*
     * To change this license header, choose License Headers in Project Properties.
     * To change this template file, choose Tools | Templates
     * and open the template in the editor.
     */
    package navigation;
    
    /**
     *
     * @author peter
     */
    import java.io.Serializable;
    import javax.faces.bean.ManagedBean;
    import javax.faces.bean.RequestScoped;
    
    @ManagedBean(name="pageBean")
    @RequestScoped
    public class PageBean implements Serializable{
        private String page;
        
        public void setPage(String page){
            this.page=page;
        }
        public String getPage(){
            return "/contact";
        }
        
        
        
    }
    

    The error is:

    
    
    FATAL:   JSF1072: com.ocpsoft.pretty.PrettyException caught during afterPhase() processing of RESTORE_VIEW 1 : UIComponent-ClientId=, Message=PrettyFaces: Exception occurred while processing <contact:#{pageBean.getPage}> for URL </contact>
    FATAL:   PrettyFaces: Exception occurred while processing <contact:#{pageBean.getPage}> for URL </contact>
    com.ocpsoft.pretty.PrettyException: PrettyFaces: Exception occurred while processing <contact:#{pageBean.getPage}> for URL </contact>
    	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:102)
    	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:121)
    	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
    	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
    	at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:344)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
    	at org.ocpsoft.rewrite.servlet.RewriteFilter.doFilter(RewriteFilter.java:205)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
    	at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:873)
    	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:739)
    	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:575)
    	at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:546)
    	at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:428)
    	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:378)
    	at org.ocpsoft.rewrite.servlet.impl.HttpRewriteResultHandler.handleResult(HttpRewriteResultHandler.java:41)
    	at org.ocpsoft.rewrite.servlet.RewriteFilter.rewrite(RewriteFilter.java:268)
    	at org.ocpsoft.rewrite.servlet.RewriteFilter.doFilter(RewriteFilter.java:188)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:316)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
    	at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
    	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
    	at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
    	at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:415)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:282)
    	at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
    	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
    	at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201)
    	at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
    	at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
    	at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
    	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
    	at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
    	at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
    	at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    	at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
    	at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
    	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
    	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
    	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
    	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
    	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
    	at java.lang.Thread.run(Thread.java:745)
    Caused by: javax.el.PropertyNotFoundException: The class 'navigation.PageBean' does not have the property 'getPage'.
    	at javax.el.BeanELResolver.getBeanProperty(BeanELResolver.java:731)
    	at javax.el.BeanELResolver.getType(BeanELResolver.java:301)
    	at com.sun.faces.el.DemuxCompositeELResolver._getType(DemuxCompositeELResolver.java:215)
    	at com.sun.faces.el.DemuxCompositeELResolver.getType(DemuxCompositeELResolver.java:242)
    	at com.sun.el.parser.AstValue.getType(AstValue.java:92)
    	at com.sun.el.ValueExpressionImpl.getType(ValueExpressionImpl.java:201)
    	at com.ocpsoft.pretty.faces.util.FacesElUtils.getExpectedType(FacesElUtils.java:50)
    	at com.ocpsoft.pretty.faces.beans.ParameterInjector.injectPathParams(ParameterInjector.java:79)
    	... 51 more
    
    • This reply was modified 1 year, 3 months ago by  Peter-TI.
    #27080

    You have to use the name of the property, not the name of the method in the path pattern.

    Try:

    <pattern value="/#{pageBean.page}" />
    
    #27081

    Peter-TI
    Participant

    Thanks a lot,
    It’s working.

    Maybe I was asking some noob stuff. Java EE,JSF and prettyfaces where new to me.
    Thanks to you’re help I finally got my Java EE (EJB and WAR modules) up and running and visable in the browser.
    I used to work with php and put quite some efford into stepping up to Java EE.
    I love it.

    I have one more question:
    Why does this work?

    
     <url-mapping id="home">
    		<pattern value="/" />
    		<view-id value="#{loginBean.getLogin}" />
    </url-mapping>
            
    <url-mapping id="contact">
    		<pattern value="/#{pageBean.page}" />
    		<view-id value="/specifications/noordzij-it/frontend/pages/contact.xhtml" />
    </url-mapping>
    

    And this doesn’t?:

    
     <url-mapping id="home">
    		<pattern value="/" />
    		<view-id value="#{loginBean.login}" />
    </url-mapping>
            
    <url-mapping id="contact">
    		<pattern value="/#{pageBean.page}" />
    		<view-id value="/specifications/noordzij-it/frontend/pages/contact.xhtml" />
    </url-mapping>
    

    Both beans are structurally exactly the same.

    • This reply was modified 1 year, 3 months ago by  Peter-TI.
    #27083

    Could you explain a bit more what is not working? Which of the two mappings?

    Please not that pattern such as <pattern value="/#{pageBean.page}" /> are not a very good idea, as they match nearly every request. Even things like /style.css

    #27084

    Peter-TI
    Participant

    What was working was, being the wrong pattern:

    
     <url-mapping id="masterPage">
    		<pattern value="/#{pageBean.page}" />
    		<view-id value="/specifications/noordzij-it/backend/pages/index.xhtml" />
     </url-mapping>
    

    Indeed which reacted on any url request.

    And what wasn’t working was, being the right pattern:

    
       <url-mapping id="masterPage">
    		<pattern value="/#{pageBean.getPage}" />
    		<view-id value="/specifications/noordzij-it/backend/pages/index.xhtml" />
     </url-mapping>
    

    In this case I get this error:

    
    com.ocpsoft.pretty.PrettyException: PrettyFaces: Exception occurred while processing <masterPage:#{pageBean.getPage}> for URL </admin>
    	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:102)
    	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:121)
    	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
    	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
    	at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:344)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
    	at org.ocpsoft.rewrite.servlet.RewriteFilter.doFilter(RewriteFilter.java:205)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
    	at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:873)
    	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:739)
    	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:575)
    	at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:546)
    	at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:428)
    	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:378)
    	at org.ocpsoft.rewrite.servlet.impl.HttpRewriteResultHandler.handleResult(HttpRewriteResultHandler.java:41)
    	at org.ocpsoft.rewrite.servlet.RewriteFilter.rewrite(RewriteFilter.java:268)
    	at org.ocpsoft.rewrite.servlet.RewriteFilter.doFilter(RewriteFilter.java:188)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:316)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
    	at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
    	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
    	at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
    	at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:415)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:282)
    	at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
    	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
    	at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201)
    	at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
    	at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
    	at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
    	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
    	at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
    	at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
    	at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    	at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
    	at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
    	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
    	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
    	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
    	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
    	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
    	at java.lang.Thread.run(Thread.java:745)
    Caused by: javax.el.PropertyNotFoundException: The class 'navigation.PageBean' does not have the property 'getPage'.
    	at javax.el.BeanELResolver.getBeanProperty(BeanELResolver.java:731)
    	at javax.el.BeanELResolver.getType(BeanELResolver.java:301)
    	at com.sun.faces.el.DemuxCompositeELResolver._getType(DemuxCompositeELResolver.java:215)
    	at com.sun.faces.el.DemuxCompositeELResolver.getType(DemuxCompositeELResolver.java:242)
    	at com.sun.el.parser.AstValue.getType(AstValue.java:92)
    	at com.sun.el.ValueExpressionImpl.getType(ValueExpressionImpl.java:201)
    	at com.ocpsoft.pretty.faces.util.FacesElUtils.getExpectedType(FacesElUtils.java:50)
    	at com.ocpsoft.pretty.faces.beans.ParameterInjector.injectPathParams(ParameterInjector.java:79)
    	... 51 more
    

    In the OCPsoft prettyfaces manual chapter: 3.2.2. * EL-injected path parameters.
    The example pattern is:

    
    <pattern value="/store/#{ bean.category }/" />
    

    with this bean:

    
    @Named("bean")
    @RequestScoped
    public class CategoryBean {
    	private String category;
    	
    	/* Getters & Setters */
    }
    

    Wasn’t this the wrong pattern?
    Please correct me if I’m wrong.

    • This reply was modified 1 year, 3 months ago by  Peter-TI.
    #27121

    caglarturkurka
    Participant

    I have same problem.Dynamic View id not work,but When I write view id manually,it works right.Please help me can you solve your problem.

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

You must be logged in to reply to this topic.

Comments are closed.