9 Replies Latest reply on Dec 3, 2010 9:49 AM by wesleyhales

    Issue with JSF in GateIn

    nandhana03

      I'm new to GateIn... I've  successfully deployed a portlet in GateIn.... On editing the portlet,  I'm unbale to retrieve the form values as a random string preceeds the  form name. (something like _G7idhkasd897_jdhg67 followed by a colon ,  then the original form name).   I'm using  portletbridge-api-2.0.0.FINAL.jar  &  portletbridge-impl-2.0.0.FINAL.jar.   My JSF version is JSF 1.2.  The  configuration I made :

       

      faces-config.xml

      ---------------------------

       

      <application>
            <view-handler>org.jboss.portletbridge.application.PortletViewHandler</view-handler>
            <state-manager>org.jboss.portletbridge.application.PortletStateManager</state-manager>

      </application>

       

       

      web.xml

      ------------

       

      commented :

      <context-param> 
              <param-name>
                  org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL
              </param-name>
              <param-value>true</param-value>
          </context-param>

      which I used earlier while deploying my application in JBoss portal.

       

      Added :

       

      <servlet-mapping>
            <servlet-name>FacesServlet</servlet-name>
            <url-pattern>/faces/*</url-pattern>
      </servlet-mapping>

       

       

      portlet.xml

      ----------------

       

      <portlet>
               <description>Customer Portlet</description>
            <portlet-name>Customer Portlet</portlet-name>
            <display-name>Customer Portlet</display-name>
            <portlet-class>javax.portlet.faces.GenericFacesPortlet</portlet-class>
            <supports>
               <mime-type>text/html</mime-type>
               <portlet-mode>VIEW</portlet-mode>        
            </supports>
            <portlet-info>
               <title>Customer</title>
               <short-title>Customer Portlet</short-title>
               <keywords>JSF, Portlet</keywords>
            </portlet-info>
           
            <init-param>
               <name>javax.portlet.faces.defaultViewId.view</name>
               <value>/views/customer/viewCustomer.jsp</value>
            </init-param>
             <init-param>
               <name>javax.portlet.faces.preserveActionParams</name>
               <value>true</value>
            </init-param>
            <init-param>
                  <name>Administrator</name>
                  <value>true</value>
            </init-param>
            <expiration-cache>-1</expiration-cache>
         </portlet>

       

       

      anybody plz help me resolve my issue.....  thnx in advance.....

        • 1. Re: Issue with JSF in GateIn
          prabhat.jha

          Where are you trying to retrieve the form value from? Portal will generate some random id for all components not only for form. However if you specifiy a id, portal will honor that and it would something like random+your_id. The reason it's done that way because you could have same portlet multiple times on a page.

          • 2. Re: Issue with JSF in GateIn
            nandhana03

            I'm using  FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap()   to retrieve the request parameters in my back-end bean. Suppose the form name is abc & I want to  retrieve the value of a text box with id abc1. Earlier I used  FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get('abc:abc1')  to retrieve the value of the text box in my back-end bean. But now I  cannot get the value by using the same code as that random string  preceeds the form name. Is there any  method to handle this ???

            • 3. Re: Issue with JSF in GateIn
              wesleyhales

              facesContext.externalContext.response.namespace

               

              or

               

              public String getNamespace() {
              return externalContext.encodeNamespace("");
              }

              • 4. Re: Issue with JSF in GateIn
                nandhana03

                thnx 4 ur help....... could u plz explain how we can use this ?????

                • 5. Re: Issue with JSF in GateIn
                  wesleyhales

                  Dhanya Sreejith wrote:

                   

                  But now I  cannot get the value by using the same code as that random string  preceeds the form name. Is there any  method to handle this ???

                  the method I gave you is "that random string"

                  • 6. Re: Issue with JSF in GateIn
                    nandhana03

                    hii...... thnx 4 ur help...... I'm facing 1 more issue... from request map I'm getting _G6d3316b0_2d48bd_2d450f_2da091_2db08ec381dd58:j_id_jsp_436313122_0:abc:name

                     

                    where 'abc' is the form id & 'name' is a text field whose value I need to retrieve....   By using the above method(the one which u told) in my back-end bean , I got G6d3316b0_2d48bd_2d450f_2da091_2db08ec381dd58.  But I can find that in addition to this namespace something like j_id_jsp_436313122_0 also prepends the actual id. Will u plz help me to handle this also..... thnx in advace....

                    • 7. Re: Issue with JSF in GateIn
                      alexsmirnov

                      Seems that you have improper use of JSF components. Names of request parameters for JSF generated and processed by component itself, and you have no warranty what exact name is - it depends of JSF implementation, component version and environment. So, let JSF component to process these parameters and store them to beans. Creating fields by JSF component and processing them directly can cause unpredictable side effects.

                      You can only be sure about parameter name if you create it on yourself  by JavaScript, using <f:param > tag or in similar way.

                      • 8. Re: Issue with JSF in GateIn
                        nandhana03

                        thnx a lot for the info: u gave... could u plz help me to retrieve the parameters in my back end bean from a JSF page via Ajax request.(deployed in GateIn) ......will u plz provide a sample code for the same..... thnx in advance......

                        • 9. Re: Issue with JSF in GateIn
                          wesleyhales

                          Unfortunately we can't do the work for you. There are plenty of examples out there (screencasts, documentation). Start here http://jboss.org/portletbridge