4 Replies Latest reply on Jul 17, 2008 1:22 PM by Ben Maisano

    RichFaces 3.1.5 with Tiles 2.x

    Ben Maisano Newbie

      Hi,
      I'm currently trying to integrate the following technologies for a J2EE Enterprise web Application
      WebSphere 6.1
      JRE 1.5
      JSF 1.1
      Tiles 2.0
      RichFaces 3.1.5 ( I couldn't use 3.2.x b/c WebSphere 6.1 only supports JSF 1.1).

      I know normally Ajax server side methods return null and that basically tells the web container to send the request back to where it came from. However, when using Tiles, my understanding is JSF cannot navigate directly to a tiles definition, so I have a JSP page that is made special for self navigation for JSF pages. I return "selfNavigate" and have a catch all navigation rule in the JSF config file to go to this JSP, which looks in session to be able to tell which tiles def to navigate to.
      My question is how can this all work with RichFaces? Currently I'm trying to get a suggestion box to work and the list returned replaces the entire body of the screen. Any suggestions/thoughts?

        • 1. Re: RichFaces 3.1.5 with Tiles 2.x
          Ilya Shaikovsky Master

          show the code which you using ofr suggestion please.

          • 2. Re: RichFaces 3.1.5 with Tiles 2.x
            Ben Maisano Newbie

            There is a lot of code in different places, but here is what I think is relevant

            <%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
            <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
            <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
            <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
            <f:view>
            <h:form id="payeeBoBForm">
            <h:panelGroup style="display: block;">
            <h:panelGrid columns="2">
            <h:panelGroup>
            <h:inputText styleClass="inputText" id="producerName"
            value="#{payeeBookOfBusinessMB.producerName}" maxlength="60">
            </h:inputText>
            <rich:suggestionbox for="producerName" ajaxSingle="true"
            suggestionAction="#{payeeBookOfBusinessMB.getProducerNameList}" width="200"
            height="100" var="possibleNames"
            nothingLabel="No matching name" fetchValue="#{possibleNames}" minChars="2">
            <h:column>
            <h:outputText value="#{possibleNames}" />
            </h:column>
            </rich:suggestionbox>
            </h:panelGroup>
            </h:panelGrid>
            </h:form>
            </f:view>

            The java backing bean method is this:
            public List getProducerNameList(Object event){
            String partialStr= event.toString().toLowerCase();
            ProducerDelegate producerDelegate = new ProducerDelegate();
            List producerNameList = null;
            producerNameList = producerDelegate.getProducerNameList(partialStr);

            return producerNameList;
            }

            This is pretty much straight from the user_doc.pdf. I have the RichFaces jars in my WEB-INF/lib and the filter servlet config in my web.xml. The suggestion box is actually working, kind of. My problem is my method returns a list, and I think under the covers RichFaces is then returning null, which wont work with JSF and Tiles (that I know of). Let me know if you need more code, thanks.

            • 3. Re: RichFaces 3.1.5 with Tiles 2.x
              Ben Maisano Newbie

              Ok reading the doc I though the attribute "selfRendered=true" may help, so I put that in, changing the code to this:

              <rich:suggestionbox for="producerName" ajaxSingle="true"
              selfRendered="true"
              suggestionAction="#{payeeBookOfBusinessMB.getProducerNameList}" width="200"
              height="100" var="possibleNames"
              nothingLabel="No matching name" fetchValue="#{possibleNames.producerName}" minChars="2">
              <h:column>
              <h:outputText value="#{possibleNames.producerName}" />
              </h:column>
              </rich:suggestionbox>

              Now it is working on Firefox! but not on IE 6 ( we have IE 6.0.29 on XP SP2). I really need this to work on IE, just using FireFox for testing, and of course with IE I dont know the javascript error, just says error at bottom. Any ideas?

              • 4. Re: RichFaces 3.1.5 with Tiles 2.x
                Ben Maisano Newbie

                Ok I turned on script debugging in IE, and got this, seems RichFaces is using some method calls IE doesn't support for DOM objects...??

                Object or element doesn't exist
                return elements;};return function(className,parentElement){return $(parentElement||document.body).getElementsByClassName(className);};}(Element.Methods);Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(element){this.element=$(element);},_each:function(iterator){this.element.className.split(/\s+/).select(function(name){return name.length>0;})._each(iterator);},set:function(className){this.element.className=className;},add:function(classNameToAdd){if(this.include(classNameToAdd))return;this.set($A(this).concat(classNameToAdd).join(' '));},remove:function(classNameToRemove){if(!this.include(classNameToRemove))return;this.set($A(this).without(classNameToRemove).join(' '));},toString:function(){return $A(this).join(' ');}};Object.extend(Element.ClassNames.prototype,Enumerable);Element.addMethods();if(!window.RichFaces){window.RichFaces={};}

                'getElementsByClassName(..).0;' is null or not an object
                this.stopIndicator();var scroll=document.getElementsByClassName("_suggestion_size_",this.update)[0]||this.update;scroll.scrollTop=-1;scroll.scrollLeft=-1;this.index=0;this.prevIndex=-1;var nothingLabel=$(this.update.id+"NothingLabel");if(nothingLabel&&this.hasFocus&&!this.wasBlur){if(this.entryCount<1){Element.show(nothingLabel);Event.observe(nothingLabel,"click",this.onNothingLabelClick);Event.observe(this.element,"blur",this.onNothingLabelClick);this.show();}}

                I still have no idea how to fix this, or what RichFaces components/attributes I should avoid in doing this. Has anyone successfully setup a suggestion box in IE with JSF and Tiles?