4 Replies Latest reply on Feb 12, 2009 10:16 AM by chancey

    Need to get request parameters in JSF Portlet

      JBoss Portal Version : 2.7.0
      JBoss AS Version: 4.3.2
      OS Platform : Windows XP

      I need to get GET-parameters and some of the JBoss Portal page propeties in backing bean of my JSF Portlet. Please help me.

        • 1. Re: Need to get request parameters in JSF Portlet
          antoine_h

          look at the samples and how the administration of the portal is programmed.

          you can get it through some specific variables that are declared by the portal, for use in the JSF, that is in EL expression.

          look in the file :
          deploy\jboss-portal.sar\portal-admin.sar\portal-admin.war\WEB-INF\faces-config.xml

          you'll find there the jsf variable resolver, that provides the variables to get portal informations inside the JSF.

          and look at the portal administration pages.
          with files like : deploy\jboss-portal.sar\portal-admin.sar\portal-admin.war\WEB-INF\jsf\editContext.xhtml
          and code like :

          <c:when test="#{portalobjectmgr.selectedObject.type == PortalObject.TYPE_CONTEXT}">#{bundle.PORTALS_NO_CAP}</c:when>


          I don't remember exactly but I think you can get what you want this way.
          for the Get parameter... I am not sure...
          but may be you can make something similar, with a resolver that provide the request param.
          the best would be to see how the portlet request parameter is "transfered" to the JSF context.
          - do you use of the JBoss Portlet Bridge ? or another bridge for using some JSF in a portlet ?
          - in JSF, did you looked at the ExternalContext to get the context ? ... may be they are yet there...

          hope it helps,

          • 2. Re: Need to get request parameters in JSF Portlet

            Thank you Antoine_h. I'll try to do your way as soon as I can.

            I'm using jboss portletbridge B6 and jsf-facelets-1.1.15.B1

            I've also found some example showing how to get PortalNode object in
            JSF portlet. It looks like this:



            // Get render request object that contains needed info
            JBossRenderRequest req =
             (JBossRenderRequest) FacesContext.getCurrentInstance()
             .getExternalContext().getRequest();
            // Extract window name for this portlet
            String windowName = req.getPortalNode().getName();


            It seems tobe just what I need, but the problem is that I can't get FacesContext object. As I understand it is described in jsf-api libray. But when I'm trying to deploy my portlet together with portletbridge and jsf-api library, I'm getting error:

            Exception sending context initialized event to listener instance of class org.jboss.web.jsf.integration.config.JBossJSFConfigureListener
            com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! org.jboss.portletbridge.context.FacesContextFactoryImpl

            May be I'm doing somthing wrong? Or are there any other ways to solve the problem using jsfportletbridge?



            • 3. Re: Need to get request parameters in JSF Portlet
              wesleyhales

              Get rid of JSF libs in you web-inf/lib and use the default ones in JBoss app server.

              • 4. Re: Need to get request parameters in JSF Portlet

                 

                "wesleyhales" wrote:
                Get rid of JSF libs in you web-inf/lib and use the default ones in JBoss app server.


                What do you mean "default"? Should I put jsf-api library in server/default/lib folder to use it as a default library? Or are there any jsf libraries implemented in JBoss app server