5 Replies Latest reply on Feb 7, 2011 1:48 PM by Rich Raposa

    how use JSF EL in Portlet ?

    Claudio Miranda Novice

      Hi guys,

       

      my system
      JBoss EPP 5.0.1

      GateIn 3.1.0

       

      I need to use an external tag library, (provided by the customer), it is the xhtml header for each displayed page.

       

      It looks like

       

      {code}<c:set var="_area" value="#{not empty area ? area : session.servletContext.getInitParameter('br.company.area')}"/>{code}

       

      It runs fine if the page is rendered outside the portal, but rendered inside it throws

       

      {code}

      Caused by: javax.el.PropertyNotFoundException: //opt/jboss-epp-5.0.1/jboss-as/server/bb-portal/deploy/bb/04-applications/bb-cor-portal-portlets.war/WEB-INF/lib/ibcb-layout-1.1.0.jar/META-INF/layout/

      head.xhtml @13,40 test="#{_area == 'trabalho'}": //opt/jboss-epp-5.0.1/jboss-as/server/bb-portal/deploy/bb/04-applications/bb-cor-portal-portlets.war/WEB-INF/lib/ibcb-layout-1.1.0.jar/META-INF/layou

      t/head.xhtml @7,136 value="#{not empty area ? area : session.servletContext.getInitParameter('br.company.area')}": Property 'servletContext' not found on type org.gatein.pc.portlet.impl.jsr168.api.PortletSessionImpl

              at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:73)

              at com.sun.facelets.tag.TagAttribute.getObject(TagAttribute.java:233)

       

       

      {code}

       

      I see that PortletSessionImpl is not a subclass of HttpSession and it is not going to work, because it doesnt have getServletContext, but getPortletContext.

       

      But I ask if there is some workaround or configuration property for gatein or portletbridge as to make that EL work.

       

      What are your thoughts ?

       

      Thanks

       

      Claudio

        • 1. how use JSF EL in Portlet ?
          Prabhat Jha Master

          Hi Claudio,

           

          Given that you are using EPP 5.0.1, I am assuming you have support contract. Have you tried asking your question using support ticket already? You might get faster response that way.

           

          Thanks,

          Prabhat

          • 2. how use JSF EL in Portlet ?
            Claudio Miranda Novice

            I have not tried it yet, but will do.

             

            Thanks Prabhat

            • 3. how use JSF EL in Portlet ?
              Rich Raposa Novice

              From looking at your code, it looks like you are trying to retrieve an init parameter. Is that defined in your portlet.xml? Or are you trying to get a servlet init param from web.xml?

               

              Also, I think you want to use the EL syntax for the portlet session object in your JSF/Facelets page. It should look something like:

               

              #{httpSessionScope['my_param_name']}

              • 4. how use JSF EL in Portlet ?
                Claudio Miranda Novice

                Hi Rich, the issue is the session EL variable doesn't recognize the "servletContext" property ( getServletContext() method ).

                 

                Also, it is going to be hard (not impossible) to change the facelet component, provided by the customer. If EPP guys can provide some workaround to make it work, cool ! Otherwise, I will recommend to change the facelet component.

                 

                Thanks

                 

                Claudio

                • 5. how use JSF EL in Portlet ?
                  Rich Raposa Novice

                  If you put the following in your JSP page:

                   

                  session.servletContext

                   

                  then the JSP engine looks for a property named "servletContext", which is not the same thing as invoking the getServletContext method. If you look at your error, you're getting a javax.el.PropertyNotFoundException because behind-the-scenes you get:

                   

                  session.getProperty("servletContext")

                   

                  My guess is you are going to need to edit some code in your backing beans to make this work. I'm not sure this is an EPP issue that warrants changes made to the platform.