6 Replies Latest reply on Jul 6, 2006 6:04 PM by Roy Russo

    Sample portlet project - with JSF

    Yaron Gilboa Newbie

      hi,

      I am looking for a sample portlet project which can be imported to the Eclipse IDE (or any similar tools such as netbeans). The project should include a portlet which uses JSF (this is crucial), and that actually runs :)

      I am using the latest versions of JBoss Portal and Eclipse.

      any help here would be appreciated,

      p.s.

      I am still novice to the Java world, and not very apt (at the moment) in configuration matters.

        • 1. Re: Sample portlet project - with JSF
          Krzysztof Samplawski Newbie

          Yeah, example portlet application using JSF (facelets) would be of great help :)

          • 3. Re: Sample portlet project - with JSF
            Yaron Gilboa Newbie

            hi,

            I've tried to use the card-demo sample as a reference, and I still get a JasperException. Here are the errors:

            13:59:54,462 ERROR [UIComponentTag] Faces context not found. getResponseWriter will fail. Check if the FacesServlet has been initialized at all in your web.xml.
            13:59:54,462 ERROR [CommandFilter] Exception in command invocation
            org.apache.jasper.JasperException
            at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:370)
            at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
            at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
            ...

            13:59:54,477 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
            java.lang.NullPointerException
            at javax.faces.webapp.UIComponentTag.setupResponseWriter(UIComponentTag.java:615)
            at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:217)
            at org.apache.myfaces.taglib.core.ViewTag.doStartTag(ViewTag.java:71)
            at org.apache.jsp.jsp.TestJSFPortlet.view_jsp._jspx_meth_f_view_0(org.apache.jsp.jsp.TestJSFPortlet.view_jsp:79)
            at org.apache.jsp.jsp.TestJSFPortlet.view_jsp._jspService(org.apache.jsp.jsp.TestJSFPortlet.view_jsp:57)
            at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)

            • 4. Re: Sample portlet project - with JSF
              Roy Russo Master

              I've created a new set of portal/portlet sample for 2.4 here http://anonsvn.jboss.org/repos/portletswap/portlets/2_4/bundles/

              Keep in mind the descriptors have changed a bit in 2.4, so they may not show up, without some modifications in 2.2.

              • 5. Re: Sample portlet project - with JSF
                Yaron Gilboa Newbie

                ok ... it's working :)

                However, i've noticed that you take two different approaches for JSF vs. JSP:

                1) In the JSP sample you create a Portlet class (using JSR-168 API).

                2) In the JSF sample you use a set of JSP pages (with JSF taglibs), with no intermediary Portlet class.

                Is this the best practice, or is it just a short cut for convenincy ?

                • 6. Re: Sample portlet project - with JSF
                  Roy Russo Master

                   

                  "gilboay" wrote:
                  1) In the JSP sample you create a Portlet class (using JSR-168 API).

                  2) In the JSF sample you use a set of JSP pages (with JSF taglibs), with no intermediary Portlet class.

                  Is this the best practice, or is it just a short cut for convenincy ?


                  The JSP example uses dispatching to JSP for rendering fragments. JSF handles the dispatching for you, by the navigation controller that is defined in the faces-config.xml. The advantage to JSF is that it provides a framework to build portlets with.

                  For simple (2-3 page) applications, I would hack together with JSP. For applications that need flow control, validation, conversion, custom components, then I would use JSF.