4 Replies Latest reply on Feb 2, 2007 4:55 AM by Chua Khoon Yong

    AJAX4JSF in Portal

    Chua Khoon Yong Novice

      Dear all,

      I'm trying to do partial page refresh in Jboss portal and was trying to incooperate AJAX4JSF into portal, but failed. Can AJAX4JSF work in portal?

      My setup is:

      - JBoss AS 4.0.5
      - Portal 2.4.1
      - Seam 1.1.1

      I compare the seam booking example and added the necessary statements in my web.xml file. But when i click on a normal .xhtml page, i got this nasty error. Whats wrong? Should i try icefaces. Btw, i don't know which is better: icefaces or ajax4jsf?

      Note that my web pages are working fine before i start to incooperate ajax4jsf.

      Your help is very much appreciated.
      Thank you.

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

      java.lang.ClassCastException: org.jboss.portlet.JBossRenderRequest
      at com.sun.facelets.FaceletViewHandler.createResponseWriter(FaceletViewHandler.java:398)
      at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:527)
      at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:101)
      at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:222)
      at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
      at org.apache.myfaces.portlet.MyFacesGenericPortlet.nonFacesRequest(MyFacesGenericPortlet.java:322)
      at org.apache.myfaces.portlet.MyFacesGenericPortlet.nonFacesRequest(MyFacesGenericPortlet.java:297)
      at org.apache.myfaces.portlet.MyFacesGenericPortlet.facesRender(MyFacesGenericPortlet.java:379)
      at org.apache.myfaces.portlet.MyFacesGenericPortlet.doView(MyFacesGenericPortlet.java:265)
      at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:133)
      at javax.portlet.GenericPortlet.render(GenericPortlet.java:306)
      at org.jboss.portal.portlet.container.PortletContainer.invokeRender(PortletContainer.java:518)

      .....

        • 1. Re: AJAX4JSF in Portal
          Viet Master

          did you put that in your face-config.xml

           <application>
           <view-handler>com.sun.facelets.FaceletPortletViewHandler</view-handler>
           </application>
          


          Edit : removed <property-resolver>org.jboss.portal.faces.el.DelegatingPropertyResolver</property-resolver>. The original intent was to only talk about the view handler


          • 2. Re: AJAX4JSF in Portal
            Chua Khoon Yong Novice

            hi Julien,

            I did have the faceletPortletViewHandler in the face-config.xml.

            What is the thing about property-resolver in your reply?

            Thanks.

            • 3. Re: AJAX4JSF in Portal
              Chua Khoon Yong Novice

              hi Julien,

              I remove the FaceletPortletViewHandler entry from faces-config.xml and didn't encountered the issue. I also added the view handler in web.xml:


              <context-param>
              <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
              <param-value>com.sun.facelets.FaceletPortletViewHandler</param-value>
              </context-param>


              Then, i added a simple ajax tag as follows:

              <h:inputText value="#{search.noOfRows}" >
              <a:support event="onkeyup" requestDelay="3" />
              </h:inputText>


              But it gave me a A4J is undefined error.


              I try to trace the source code and found that it could be caused by AjaxContext:processHeadResources failing in the 2 "if" statements because i didn't see the debug log printout.

              public void processHeadResources(FacesContext context)
              throws FacesException {
              ExternalContext externalContext = context.getExternalContext();
              Map requestMap = externalContext.getRequestMap();
              if (!Boolean.TRUE.equals(requestMap.get(RESOURCES_PROCESSED))) {
              if (null != requestMap.get(BaseFilter.RESPONSE_WRAPPER_ATTRIBUTE)) {
              if (log.isDebugEnabled()) {
              log
              .debug("Process component tree for collect used scripts and styles");
              }
              UIViewRoot root = context.getViewRoot();


              Sorry, i'm not sure how to proceed on this.
              Is there a sample that i could download that illustrate the setup for:

              AS 4.0.5, Portal 2.4.1, Seam 1.1.1, Facelets.

              Thanks in advance.


              • 4. Re: AJAX4JSF in Portal
                Chua Khoon Yong Novice

                hi all,

                I think i could workaround this issue by including AJAX.js in the web pages (.xhtml) files. Could somebody help to illustrate how to do include AJAX.js in this environment:

                - Jboss AS 4.0.5
                - Portal 2.4.1
                - Seam 1.1.5
                - facelets
                - AJAX 1.0.6

                Thanks in advance.