1 2 Previous Next 20 Replies Latest reply on Mar 24, 2011 3:50 PM by Christian Yttesen

    JSF2.0 - Implicit navigation

    Christian Yttesen Newbie

      Hi,

       

      I'm in the phase of migrating an application from RichFaces 3.3.2 to 3.3.3 (JSF2) and have replaced my navigation rules with the implicit navigation.

       

      I have some <h:commandButtons /> and <h:commandLinks /> implemented as actions (they are using <f:setPropertyActionListener />, so using actionListeners is not an option) - all returns "null" as they shall render the same page they where fired from.

       

      After upgrading to RichFaces 3.3.3 using JSF2 capabilities the actions that returns "null" fails with:

       

      404 /s/.jsf

       

      "s" being my webapp context.

       

      No apparent errors are logged - using log-level 'debug' I get:

      2011-02-28 08:04:55,817    DEBUG 'Process after phase INVOKE_APPLICATION 5'

      2011-02-28 08:04:55,817    DEBUG 'Process before phase RENDER_RESPONSE 6'

      2011-02-28 08:04:55,817    DEBUG 'PhaseListener enter Before RenderView Phase with ViewId /.jsp and RenderKitId HTML_BASIC'

      2011-02-28 08:04:55,817    DEBUG 'Process after phase RENDER_RESPONSE 6'

      2011-02-28 08:04:55,818    DEBUG 'create HTML/XML parser for content type: null'

      2011-02-28 08:04:55,818    DEBUG 'Finished request processing total time 27ms for uri: /s/main.jsf'

       

      Resulting in the 404.

       

      I have tried writing the name of the file - however as this contains a <rich:tabPanel /> this results in the first tab always being selected.

       

      So I guess my question boils down to whether its allowed to return null for an Action using implicit navigation? At least in the case where the page contains a <rich:tabPanel /> its seems that JSF 2.0 is not directly backwards compatible with JSF 1.2.

       

      Regards

      Christian

        • 1. JSF2.0 - Implicit navigation
          Ilya Shaikovsky Master

          show web.xml please

          • 2. Re: JSF2.0 - Implicit navigation
            Christian Yttesen Newbie

            Hi Ilya,

             

            Sure, here it goes:

             

            <?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="selfcare" version="2.5">
                <display-name>MDC.SelfCare-1.0</display-name>
                <welcome-file-list>
                    <welcome-file>index.jsp</welcome-file>
                </welcome-file-list>
                <context-param>
                    <param-name>javax.faces.DISABLE_FACELET_JSF_VIEWHANDLER</param-name>
                    <param-value>true</param-value>
                </context-param>
                <context-param>
                    <description>
                        Set this flag to true if you want the JavaServer Faces
                        Reference Implementation to verify that all of the application
                        objects you have configured (components, converters,
                        renderers, and
                        validators) can be successfully created.
                        Default value is false.
                    </description>
                    <param-name>com.sun.faces.verifyObjects</param-name>
                    <param-value>true</param-value>
                </context-param>
                <context-param>
                    <description>
                        Set this flag to true if you want the JavaServer Faces
                        Reference Implementation to validate the XML in your
                        faces-config.xml
                        resources against the DTD. Default
                        value is false.
                    </description>
                    <param-name>com.sun.faces.validateXml</param-name>
                    <param-value>true</param-value>
                </context-param>
                <context-param>
                    <param-name>facelets.LIBRARIES</param-name>
                    <param-value>/WEB-INF/taglibs/mdc-taglib.xml</param-value>
                </context-param>
                <context-param>
                    <param-name>facelets.SKIP_COMMENTS</param-name>
                    <param-value>true</param-value>
                </context-param>
            
                <listener>
                    <listener-class>mdc.selfcare.listener.ConfigListener</listener-class>
                </listener>
                <listener>
                    <listener-class>mdc.selfcare.listener.Log4jListener</listener-class>
                </listener>
            
                <filter>
                    <display-name>RichFaces Filter</display-name>
                    <filter-name>richfaces</filter-name>
                    <filter-class>org.ajax4jsf.Filter</filter-class>
                </filter>
            
                <filter-mapping>
                    <filter-name>richfaces</filter-name>
                    <servlet-name>Faces Servlet</servlet-name>
                    <dispatcher>REQUEST</dispatcher>
                    <dispatcher>FORWARD</dispatcher>
                    <dispatcher>INCLUDE</dispatcher>
                </filter-mapping>
            
                <servlet>
                    <servlet-name>Faces Servlet</servlet-name>
                    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
                    <load-on-startup>1</load-on-startup>
                </servlet>
                <servlet>
                    <servlet-name>Register Session Servlet</servlet-name>
                    <servlet-class>mdc.selfcare.utility.RegisterSessionServlet</servlet-class>
                    <load-on-startup>2</load-on-startup>
                </servlet>
                <servlet-mapping>
                    <servlet-name>Faces Servlet</servlet-name>
                    <url-pattern>*.jsf</url-pattern>
                </servlet-mapping>
                <servlet-mapping>
                    <servlet-name>Register Session Servlet</servlet-name>
                    <url-pattern>registerSession</url-pattern>
                </servlet-mapping>
            
                <session-config>
                    <session-timeout>15</session-timeout>
                </session-config>
            </web-app>
            
            • 3. Re: JSF2.0 - Implicit navigation
              Ilya Shaikovsky Master

              Ah.. you not using facelets.. And we checked only facelets environment and found no problems as written here http://community.jboss.org/wiki/RichFaces333andJSF20. And I'm really not sure if JSF 2 itself supports implicit navigation using JSP..

              • 4. Re: JSF2.0 - Implicit navigation
                Christian Yttesen Newbie

                I am using facelets? what did I misconfigure in web.xml?

                • 5. Re: JSF2.0 - Implicit navigation
                  Christian Yttesen Newbie

                  HI Ilya,

                   

                  Appreciate any updates on this topic - is my web.xml misconfigured ?

                   

                  Regards,

                  Christian

                  • 6. Re: JSF2.0 - Implicit navigation
                    Ilya Shaikovsky Master

                    Sorry, for the delay.. No I'm looked at wrong place.. And according to your web.xml you using facelets and the configuration looks good.. could you please create minimalistic sample of the problem and attach war file or sources?

                    • 7. Re: JSF2.0 - Implicit navigation
                      Christian Yttesen Newbie

                      Hi Ilya,

                       

                      Forgot how you "attach" big files to a reply so I've created a simple war file utilizing a tabpanel with a managebean returning NULL for an action.

                       

                      Clicking on the button on tab 2 results in a: 404 /implicitnavigation/.jsf

                       

                      You can download the war file here: http://ge.tt/7sFbkrn - let me know if you fail to get it.

                       

                      Regards

                      Christian

                      • 8. Re: JSF2.0 - Implicit navigation
                        Lu Han Newbie

                        <h:commandButton action="#{myManagedBean.implicitNavigationNull}" value="Click here" />

                         

                        Do you mean the page will be forward to some url after click the button?

                         

                        If so, please set the url as the result value in the following mehod:

                         

                        public String implicitNavigationNull() {

                            return null;

                          }

                        • 9. Re: JSF2.0 - Implicit navigation
                          Christian Yttesen Newbie

                          No I just want it to return to the same page (and in this case the selected tab (tab2)) just like it will in JSF1.2

                          • 10. Re: JSF2.0 - Implicit navigation
                            Christian Yttesen Newbie

                            Hi Ilya,

                             

                            Any chance you have looked at this? I've implemented a workaround so the tabPanel knows which tab to preselect. I'm just seeking clarification on whether this is JSF2 issue or richfaces issue - or none at all (meaning that returning NULL from an action is not supported if implicit navigation in JSF2 is used).

                             

                            Regards

                            Christian

                            • 11. Re: JSF2.0 - Implicit navigation
                              Ilya Shaikovsky Master

                              If you could attach war file with java sources - would be good for quick investigation..

                               

                              sorry but team plates is really full with very close RF 4 Final release

                              • 12. Re: JSF2.0 - Implicit navigation
                                Christian Yttesen Newbie

                                I understand - you must be busy.

                                 

                                You can still download the war file (including source) here:

                                 

                                http://ge.tt/7sFbkrn - let me know if you fail to get it.

                                 

                                Regards,

                                Christian

                                • 13. Re: JSF2.0 - Implicit navigation
                                  Ilya Shaikovsky Master

                                  downloaded abd used Tomcat 6 for deplyment (without any changes in project).

                                   

                                  button on tab 2 works fine for me (just refreshing the same page)

                                   

                                  The only minor warning shown in console

                                  24.03.2011 10:46:21 com.sun.facelets.tag.jsf.ComponentHandler isRecreateValueExpressionsOnBuildBeforeRestore

                                  WARNING: facelets.RECREATE_VALUE_EXPRESSION_ON_BUILD_BEFORE_RESTORE is set to 'true' but facelets.BUILD_BEFORE_RESTORE is set to 'false' or unset. To use facelets.RECREATE_VALUE_EXPRESSION_ON_BUILD_BEFORE_RESTORE you must also set facelets.BUILD_BEFORE_RESTORE to 'true'!

                                  • 14. Re: JSF2.0 - Implicit navigation
                                    Christian Yttesen Newbie

                                    OK - I'm using Resin 3.1.10.

                                     

                                    Sorry to have wasted your time with a, what seems to be a server related issue.

                                     

                                    Thanks a lot Ilya for taking the time - I will investigate why Resin fails.

                                     

                                    Regards,

                                    Christian

                                    1 2 Previous Next