5 Replies Latest reply on Jan 17, 2008 12:49 PM by Ariel Fernando

    sugggestionbox don't work

    Ariel Fernando Newbie

      Hi all,

      I'm having problems using rich:suggestionbox. I try to put this component in my application, but it doesn't work.

      My enviroment:

      Richfaces 3.1.3-GA
      jsf-1.2_05-b06-FCS
      Tomahawk 1.1.6
      Tomcat 6.0.14
      Hibernate...Spring...

      Problem description: when I type some chars in an inputText associated to a suggestionbox, nothing happend. No suggestion box, no erros... and the beans method associated to suggestionAction is never excecuted.

      This is my test case:

      <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
       pageEncoding="ISO-8859-1"%>
      
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
      <%@ taglib uri="http://richfaces.ajax4jsf.org/rich" prefix="rich"%>
      <%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
      
      
      <f:view>
       <f:subview id="idSubView">
       <h:form id="form">
       <h:outputText value="RAZON SOCIAL"/>
       <h:inputText id="idRazonSocial" value="#{altaNotaPedidoVenta.razonSocial}">
       <rich:suggestionbox id="idSuggestionBox"
       tokens=",["
       for="idRazonSocial"
       suggestionAction="#{altaNotaPedidoVenta.sugerirRazonSocial}"
       var="result"
       fetchValue="#{result.nombre}"
       minChars="1"
       shadowOpacity="4"
       border="1"
       width="250"
       height="150"
       shadowDepth="4"
       cellpadding="2"
       nothingLabel="NOTHING TO SHOW"
       rowNumber="5">
       <h:column>
       <h:outputText value="#{result.nombre}" />
       </h:column>
       </rich:suggestionbox>
       </h:inputText>
       </h:form>
       </f:subview>
      </f:view>
      


      And my managed bean:

      public class AltaNotaPedidoVentaBean {
      
       private String razonSocial = new String();
      
       private List<Ciudad> lista;
      
       public AltaNotaPedidoVentaBean() {
       lista = new ArrayList<Ciudad>();
       Ciudad ciudad1 = new Ciudad();
       ciudad1.setNombre("RAZON SOCIAL TESTING");
       lista.add(ciudad1);
       }
      
       public List<Ciudad> sugerirRazonSocial(Object event){
       return lista;
       }
      
       public String getRazonSocial() {
       return razonSocial;
       }
      
       public void setRazonSocial(String razonSocial) {
       this.razonSocial = razonSocial;
       }
      
      }
      


      Important:
      When page is loaded, I can see at Firefox Error Console follows message:
      Error: this.element has no properties
      Source File: http://localhost:8080/Facturacion/a4j_3_1_3.GAorg/richfaces/renderkit/html/scripts/suggestionbox.js.faces
      Line: 2
      


        • 1. Re: sugggestionbox don't work
          Nick Belaevski Master

          Could you please provide web.xml sources?

          • 2. Re: sugggestionbox don't work
            Ariel Fernando Newbie

            Hi nbelaevski,

            Yes, of course, this is my web.xml

            <?xml version="1.0" encoding="UTF-8"?>
            <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xmlns="http://java.sun.com/xml/ns/javaee"
             xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
             xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
             id="WebApp_ID" version="2.5">
             <display-name>Facturacion</display-name>
             <context-param>
             <param-name>com.sun.faces.verifyObjects</param-name>
             <param-value>true</param-value>
             </context-param>
             <context-param>
             <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
             <param-value>server</param-value>
             </context-param>
             <context-param>
             <param-name>org.richfaces.SKIN</param-name>
             <param-value>custom</param-value>
             </context-param>
             <context-param>
             <param-name>org.richfaces.LoadScriptStrategy</param-name>
             <param-value>ALL</param-value>
             </context-param>
             <context-param>
             <param-name>org.richfaces.LoadStyleStrategy</param-name>
             <param-value>ALL</param-value>
             </context-param>
             <context-param>
             <param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
             <param-value>false</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>
             <filter-name>sessionFilter</filter-name>
             <filter-class>
             org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
             </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>
             <filter-mapping>
             <filter-name>sessionFilter</filter-name>
             <url-pattern>*.faces</url-pattern>
             </filter-mapping>
             <listener>
             <listener-class>
             com.sun.faces.config.ConfigureListener
             </listener-class>
             </listener>
             <listener>
             <listener-class>
             com.sun.faces.application.WebappLifecycleListener
             </listener-class>
             </listener>
             <listener>
             <listener-class>
             org.springframework.web.context.ContextLoaderListener
             </listener-class>
             </listener>
             <servlet>
             <servlet-name>Faces Servlet</servlet-name>
             <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
             <load-on-startup>1</load-on-startup>
             </servlet>
             <servlet-mapping>
             <servlet-name>Faces Servlet</servlet-name>
             <url-pattern>*.faces</url-pattern>
             </servlet-mapping>
             <welcome-file-list>
             <welcome-file>login.faces</welcome-file>
             </welcome-file-list>
            </web-app>
            


            You can see that I put follows lines to test, but not help.
            <context-param>
             <param-name>org.richfaces.LoadScriptStrategy</param-name>
             <param-value>ALL</param-value>
            </context-param>
            <context-param>
             <param-name>org.richfaces.LoadStyleStrategy</param-name>
             <param-value>ALL</param-value>
            </context-param>
            <context-param>
             <param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
             <param-value>false</param-value>
            </context-param>
            


            When I put above lines in my web.xml, Firefox Console Error shows:

            Error: this.element has no properties
            Source File: http://localhost:8080/Facturacion/a4j_3_1_3.GAorg/richfaces/ui.pack.js.faces
            Line: 3491
            


            • 3. Re: sugggestionbox don't work
              Ariel Fernando Newbie

              I remove Tomahawk libraries only for test, but same error. What do you think?, maby, anything wrong or missing with my web.xml?.

              • 4. Re: sugggestionbox don't work
                Ariel Fernando Newbie

                Yesterday I upgrade to richfaces-3.1.4-SNAPSHOT, but error persist. When page loading finish, FF error console show "Error: this.element has no properties" bla bla bla.

                But, I download richfaces demo war file and deployed in my Tomcat...and suggestion box works fine. My web.xml and faces-config looks like web.xml and faces-config demo files...the only diference is that I don't use facelets...

                Mmm...what about VIEW-HANDLER param?. If I dont'use facelets, shuld I put something special?.

                • 5. Re: sugggestionbox don't work
                  Ariel Fernando Newbie

                  I don't know why, but now suggestiobox is working fine. I'm only replace my original test case code (see first post) and all start works...
                  This case was resolved.

                  If helps, I post code that's now is working OK.

                  <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
                   pageEncoding="ISO-8859-1"%>
                  
                  <%@ 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/rich" prefix="rich"%>
                  <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
                  
                  
                  <f:view>
                   <f:subview id="idSubview">
                   <h:form id="idForm">
                   <h:inputText id="idInput" />
                   <rich:suggestionbox id="suggestionBoxId" for="idInput" tokens=",["
                   suggestionAction="#{altaNotaPedidoVenta.sugerirRazonSocial}"
                   var="result"
                   fetchValue="#{result.nombre}"
                   first="0"
                   rowNumber="10"
                   minChars="1"
                   border="1"
                   width="280"
                   height="150"
                   nothingLabel="No titular found"
                   selfRendered="true">
                   <h:column>
                   <h:outputText value="#{result.nombre}" />
                   </h:column>
                   </rich:suggestionbox>
                   </h:form>
                   </f:subview>
                  </f:view>