3 Replies Latest reply on Jul 7, 2008 6:18 AM by Ilya Shaikovsky

    RichFaces a4j:include does not work.

    chamika deshan Newbie

      Hi
      I'm new to rich faces and a4j. And I trying to use it in my jsf project in netbeans. There I have tried the exact same example taken from this link.

      http://livedemo.exadel.com/richfaces-demo/richfaces/include.jsf?c=include

      There I include xhtml file to my jsp page like this.

      <h:panelGrid width="100%" columns="2" columnClasses="col1,col2">
       <a4j:keepAlive beanName="profile" />
       <rich:panel styleClass="wizard">
       <f:facet name="header">
       <h:outputText value="Using a4j:include for Wizard-like behaviour" />
       </f:facet>
       <h:form>
       <a4j:include viewId="wstep1.xhtml" />
       </h:form>
       </rich:panel>
       </h:panelGrid>
      


      But when run the project, nothing display. When i view the source in browser it nicely show the exact whole code in xhtml file. Means that nothing rendered, just included as text.
      Please help me out to solve this problem. I have stucked with this whole 2 days.

      -----------Here I'm including my source codes-----------------

      --JSP page--

      <?xml version="1.0" encoding="UTF-8"?>
      <jsp:root version="2.1" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:webuijsf="http://www.sun.com/webui/webuijsf" xmlns:a4j="http://richfaces.org/a4j"
       xmlns:rich="http://richfaces.org/rich">
       <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
       <f:view>
       <webuijsf:page id="page1">
       <webuijsf:html id="html1">
       <webuijsf:head id="head1">
       <webuijsf:link id="link1" url="/resources/stylesheet.css"/>
       </webuijsf:head>
       <webuijsf:body id="body1" style="-rave-layout: grid">
       <h:panelGrid width="100%" columns="2" columnClasses="col1,col2">
       <a4j:keepAlive beanName="profile" />
       <rich:panel styleClass="wizard">
       <f:facet name="header">
       <h:outputText value="Using a4j:include for Wizard-like behaviour" />
       </f:facet>
       <h:form>
       <a4j:include viewId="wstep1.xhtml" />
       </h:form>
       </rich:panel>
       </h:panelGrid>
       </webuijsf:body>
       </webuijsf:html>
       </webuijsf:page>
       </f:view>
      </jsp:root>


      --xhtml---
      <?xml version="1.0" encoding="UTF-8"?>
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:a4j="http://richfaces.org/a4j"
       xmlns:rich="http://richfaces.org/rich">
      
       <div style="position:relative;height:140px">
       <h:panelGrid style="padding: 15px" rowClasses="s1row" columns="3" columnClasses="wfcol1,wfcol2,wfcol3">
       <h:outputText value="First Name:" />
       <h:inputText id="fn" value="#{profile.firstName}" label="First Name" required="true" />
       <rich:message for="fn" />
      
       <h:outputText value="Last Name:" />
       <h:inputText id="ln" value="#{profile.lastName}" label="Last Name" required="true" />
       <rich:message for="ln" />
      
       <h:outputText value="Company:" />
       <h:inputText id="comp" value="#{profile.company}" label="Company" required="true" />
       <rich:message for="comp"/>
       </h:panelGrid>
       <div>
       <a4j:commandButton style="float:right" action="next" value="Next >>"/>
       </div>
       </div>
      </ui:composition>
      


      --faces config--

      
      <managed-bean>
       <managed-bean-name>profile</managed-bean-name>
       <managed-bean-class>com.chamika.profile</managed-bean-class>
       <managed-bean-scope>request</managed-bean-scope>
       </managed-bean>
      
      <navigation-rule>
       <from-view-id>wstep1.xhtml</from-view-id>
       <navigation-case>
       <from-outcome>next</from-outcome>
       <to-view-id>wstep2.xhtml</to-view-id>
       </navigation-case>
       </navigation-rule>
      


      --bean---
      the profile bean also there with getters and setters.


      Please help me out!


        • 1. Re: RichFaces a4j:include does not work.
          Toure Mamadou Newbie

          do you access your page with the correct extension
          for exemple:

          http://my.site.com/mypage.jsf
          or
          http://my.site.com/mypage.faces
          

          instead of http://my.site.com/mypage.xhtml

          • 2. Re: RichFaces a4j:include does not work.
            chamika deshan Newbie

            toure32, thank you very much for replying!.
            I have tried as u say.
            How ever it gives same result.

            1. http://localhost:8080/TestRichFaces (set it as main page)
            2. http://localhost:8080/TestRichFaces/faces/TestInclude.jsp


            This is the browser page source code. If u go through the code u can see that there are jsp codes with HTML That is the code segment which I include by(<a4j:include viewId="wstep1.xhtml" />).

            Please help me to solve this!

            -----------Browser HTML source code -----------------------

            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
            <html xmlns="http://www.w3.org/1999/xhtml" xmlns:wairole="http://www.w3.org/2005/01/wai-rdf/GUIRoleTaxonomy#" xmlns:waistate="http://www.w3.org/2005/07/aaa">
            <head>
            <title></title><link rel='stylesheet' class='component' type='text/css' href='/TestRichFaces/faces/a4j_3_2_0.SR1-SNAPSHOTorg/richfaces/renderkit/html/css/basic_classes.xcss/DATB/eAFjizhSBAADHgGV' /><link rel='stylesheet' class='component' type='text/css' href='/TestRichFaces/faces/a4j_3_2_0.SR1-SNAPSHOTorg/richfaces/renderkit/html/css/extended_classes.xcss/DATB/eAFjizhSBAADHgGV' /><script type='text/javascript' src='/TestRichFaces/faces/a4j_3_2_0.SR1-SNAPSHOTorg.ajax4jsf.javascript.AjaxScript'></script><script type="text/javascript">var webui_suntheme4_2={"webuiAll":false,"parseOnLoad":true,"theme":{"locale":"en-us"},"isStyleSheet":true,"isDebug":false,"webuiJsfx":false,"ajax":{"isJsfx":true}};</script><script type="text/javascript" src="/TestRichFaces/theme/com/sun/webui/jsf/suntheme4_2-080320/javascript/bootstrap.js"></script><link id="link1" rel="stylesheet" type="text/css" href="/TestRichFaces/resources/stylesheet.css" />
            </head><body id="body1" style="-rave-layout: grid"><form id="form1" class="form" method="post" action="/TestRichFaces/faces/TestInclude.jsp" enctype="application/x-www-form-urlencoded">
            <span id="form1:wizard"><span id="form1:j_id_id11"></span>
            
            <ui:composition xmlns="http://www.w3.org/1999/xhtml"
             xmlns:ui="http://java.sun.com/jsf/facelets"
             xmlns:h="http://java.sun.com/jsf/html"
             xmlns:f="http://java.sun.com/jsf/core"
             xmlns:a4j="http://richfaces.org/a4j"
             xmlns:rich="http://richfaces.org/rich">
            
             <div style="position:relative;height:140px">
             <h:panelGrid rowClasses="s1row" columns="3" columnClasses="wfcol1,wfcol2,wfcol3">
             <h:outputText value="First Name:" />
             <h:inputText id="fn" value="#{profile.firstName}" label="First Name" required="true" />
            
             <rich:message for="fn" />
            
             <h:outputText value="Last Name:" />
             <h:inputText id="ln" value="#{profile.lastName}" label="Last Name" required="true" />
             <rich:message for="ln" />
            
             <h:outputText value="Company:" />
             <h:inputText id="comp" value="#{profile.company}" label="Company" required="true" />
             <rich:message for="comp"/>
            
            
            
             </h:panelGrid>
             <div class="navPanel">
            
             <a4j:commandButton id="wizardNext" value="Next >>" style="float:right" action="next"/>
             </div>
             </div>
            </ui:composition>
            
            </span><input id="form1:j_id_id12" name="form1:j_id_id12" onclick="A4J.AJAX.Submit('j_id_id2','form1',event,{'parameters':{'form1:j_id_id12':'form1:j_id_id12'} ,'actionUrl':'/TestRichFaces/faces/TestInclude.jsp'} );return false;" type="button" />
            <input id="form1_hidden" name="form1_hidden" value="form1_hidden" type="hidden" />
            <input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="H4sIAAAAAAAAAJ1X62scVRz7VtH2W3D7j+sPXJ1sIPP/a8cLba0MGLr4K7FMfd17VPpF8uynXvJdQlt277GOyOvpIOtv8FJIZENf4NAAA=" />
            </form>
            <script type="text/javascript">webui.suntheme4_2.dojo.addOnLoad(function() {new webui.suntheme4_2.body('/TestInclude.jsp', '/TestRichFaces/faces/TestInclude.jsp',null,null,'com_sun_webui_util_FocusManager_focusElementId',true);});</script></body></html>