5 Replies Latest reply on Mar 27, 2009 4:08 PM by nbelaevski

    Ajax Support won't work in my Pages

      I tried out the short RichFaces Tutorial at http://docs.jboss.org/tools/movies/demos/rich_faces_demo/rich_faces_demo.swf. It's essentially the same example as shown on the RichFaces Live Demo page for the AjaxSupport.

      Just something like that:

      <h:form>
       <rich:panel header='Simple Echo'>
       <h:inputText value="#{bean.text}">
       <a4j:support event="onkeyup" reRender="repeater"/>
       </h:inputText>
       <h:outputText id="repeater" value="#{bean.text}"/>
       </rich:panel>
      </h:form>
      


      When I build and deploy this little project, I can start the example in JBOSS (4.2.3), but the page simply doesn't do anything. I can enter some text in the input field, but the outputText "repeater" keeps empty.

      When I looked into the generated web page, I saw that no Javascript Libraries are inculde in the <script scr=..:" part of the page. So of course there's no Ajax Action in my page.
      In the RichFaces Live Demo Page there is:


      <script src="/richfaces-demo/a4j/g/3_3_0.GA/org/ajax4jsf/framework.pack.js.jsf" type="text/javascript"></script>
      <script src="/richfaces-demo/a4j/g/3_3_0.GA/org/richfaces/ui.pack.js.jsf" type="text/javascript"></script>


      I've done the mentioned tutorial several times now, but always with the same result. What am I missing to get the Javascript Libraries included into my page, or to get this example to work somehow.

      Regards
      Michael



        • 1. Re: Ajax Support won't work in my Pages
          ilya_shaikovsky

          do you have RF filter in web.xml?

          • 2. Re: Ajax Support won't work in my Pages

            OK, this was really stupid:

            When I used JBOSS Tools in Eclipse to put some RichFaces GUI Elemets on the Page, my Web.xml was automatically modified in the Background. That's what have been put into web.xml

            <context-param>
             <param-name>org.richfaces.SKIN</param-name>
             <param-value>blueSky</param-value>
            </context-param>
            
            <context-param>
             <param-name>org.richfaces.CONTROL_SKINNING</param-name>
             <param-value>enable</param-value>
            </context-param>
            
            
            <filter>
             <display-name>RichFaces Filter</display-name>
             <filter-name>richfaces</filter-name>
             <filter-class>org.ajax4jsf.Filter</filter-class>
            </filter>
            
            <filter-mapping>
             <filter-name>richfaces</filter-name>
             <servlet-name>Faces Servlet</servlet-name>
             <dispatcher>REQUEST</dispatcher>
             <dispatcher>FORWARD</dispatcher>
             <dispatcher>INCLUDE</dispatcher>
            </filter-mapping>
            
            



            Thats exactly the same as shown in the RichFaces "Getting Started" Guide at http://www.jboss.org/file-access/default/members/jbossrichfaces/freezone/docs/devguide/en/html/GettingStarted.html

            So, of course I thought it has to be that way. BUT: Accidentally I used the Context Menu on the Project in Eclipse (Web Projects View) and chose JBOSS Tools JSF-> Add custom capabilities->JBOSS Rich Faces 3.3
            Now my web.xml was modified again, but this time the filter setting was applied this way:

            
            <context-param>
             <param-name>org.ajax4jsf.SKIN</param-name>
             <param-value>classic</param-value>
             </context-param>
             <filter>
             <display-name>Ajax4jsf Filter</display-name>
             <filter-name>ajax4jsf</filter-name>
             <filter-class>org.ajax4jsf.Filter</filter-class>
             </filter>
             <filter-mapping>
             <filter-name>ajax4jsf</filter-name>
             <servlet-name>Faces Servlet</servlet-name>
             <dispatcher>REQUEST</dispatcher>
             <dispatcher>FORWARD</dispatcher>
             <dispatcher>INCLUDE</dispatcher>
             </filter-mapping>
            


            With these Settings it works now!
            So the "Getting started" guide seems to be outdated as well as the automated Tooling in JBOSS Tools for Eclipse. Without this tricky context menu in Eclipse I would have never figured out was was wrong.

            Regards
            Peter

            • 3. Re: Ajax Support won't work in my Pages
              ilya_shaikovsky

              both mappings are ok.. seems just deployment problem.

              • 4. Re: Ajax Support won't work in my Pages

                I haven't really deployed yet. Just tried it out in eclipses internal browser and eclipse "run as.." ->"on server" Feature.

                • 5. Re: Ajax Support won't work in my Pages
                  nbelaevski

                  Eclipse deploys files internally. Please check if deployment folder (double click server to open properties view and look what deployment folder is used) contains actual version of web.xml with correct filter mappings.