2 Replies Latest reply on Jul 12, 2011 7:47 AM by selfcare

    Navigation in JSF 2.0 in Maven based project

    selfcare

      Hi,

       

      I am using JSF 2.0 on Jboss AS 6 and GateIn 3.1

       

      I am navigating from one page to another based upon results from a bean.

       

      Below is the code in my bean

       

      @ManagedBean(name = "myBean")

      @SessionScoped

       

      public class myBean implements Serializable {

       

          public void test(){

              System.out.println("Control is comming inside the bean");

          }

         

      }

       

       

       

      Below is the code in my xhtml file

       

      <h:commandLink action="#{myBean.test}">

        <h:outputText value="Submit &raquo;" escape="false"></h:outputText>

      </h:commandLink>

       

      I have deployed my application on GateIn 3.1

       

      When I click on command link its not even calling test method in bean (just wanted to make sure atleast control is going to bean). Browser points to the same page and throws HTTP status 404.

       

      Some where read that I have to use portlet bride. Not getting much details on the same.

       

      Please share info on using portlet bridge on JSF 2.0 (or any other way I can solve this)

       

      Regards,

        • 1. Re: Navigation in JSF 2.0 in Maven based project
          selfcare

          After changing web.xml and portlet.xml its working..

           

          My web.xml and portlet.xml are pasted below (Updations which I did are in bold letters)

           

          web.xml

          =================

           

          <?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>User registration Verdion 2.0</display-name>

            <context-param>

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

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

            </context-param>

            <context-param>

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

              <param-value>Development</param-value>

            </context-param>

            <context-param>

              <param-name>org.richfaces.SKIN</param-name>

              <param-value>blueSky</param-value>

            </context-param>

            <context-param>

                  <param-name>javax.portlet.faces.RENDER_POLICY</param-name>

                  <param-value>ALWAYS_DELEGATE</param-value>

              </context-param>

              <context-param>

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

                  <param-value>FIX_PORTLET_LIFECYCLE</param-value>

              </context-param>

            <listener>

              <listener-class>com.sun.faces.config.ConfigureListener</listener-class>

            </listener>

            <servlet>

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

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

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

            </servlet>

            <servlet-mapping>

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

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

              <url-pattern>/faces/*</url-pattern>

            </servlet-mapping>

            <welcome-file-list>

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

            </welcome-file-list>

            <mime-mapping>

              <extension>ecss</extension>

              <mime-type>text/css</mime-type>

            </mime-mapping>

            <context-param>

              <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>

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

              <param-value>client</param-value>

            </context-param>

            <context-param>

              <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>

              <param-value>resources.application</param-value>

            </context-param>

          </web-app>

           

           

          =========================

          portlet.xml

          =========================

           

          <?xml version="1.0" encoding="UTF-8"?>

          <portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"

          version="2.0"

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

             xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd

             http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">

          <portlet>

                  <portlet-name>UserRegistrationPortlet</portlet-name>

                  <portlet-class>javax.portlet.faces.GenericFacesPortlet</portlet-class>

                  <init-param>

                      <name>javax.portlet.faces.defaultViewId.view</name>

                      <value>/WEB-INF/jsp/html/index.jsf</value>

                  </init-param>

           

                  <init-param>

                      <name>javax.portlet.faces.preserveActionParams</name>

                      <value>true</value>

                  </init-param>

           

                  <supports>

                      <mime-type>text/html</mime-type>

                      <portlet-mode>VIEW</portlet-mode>

                  </supports>

                  <portlet-info>

                      <title>UserRegistrationPortlet Portlet</title>

                  </portlet-info>

              </portlet>

            

          </portlet-app>

           

          ========================

           

          But, now ajax related code is not working (a4j) ..

           

           

          What could be the problem?

           

           

          Regards,

          • 2. Re: Navigation in JSF 2.0 in Maven based project
            selfcare

            Forgot to include this...

             

            Am using portletbridge-api-3.0.0.Beta1.jar and portletbridge-impl-3.0.0.Beta1.jar

             

            Regards,