I am sure I am doing something stupid so I apologize up front. I cannot get rich:autocomplete to save my life.
I get this error when I load the page "Servlet.service() for servlet FacesServlet threw exception: java.lang.IllegalArgumentException: Width (2000) and height (0) cannot be <= 0"
I have seen several posts about this so I checked our web.xml and you can see we have the params everyone has suggested
<?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"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<display-name>Phizzle Platform</display-name>
<welcome-file-list>
<welcome-file>index.jsf</welcome-file>
</welcome-file-list>
<context-param>
<param-name>org.richfaces.skin</param-name>
<param-value>plain</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.enableControlSkinning</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.responsiveDesign</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.clientSideStyle</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Production</param-value>
</context-param>
<context-param>
<param-name>javax.faces.SEPARATOR_CHAR</param-name>
<param-value>-</param-value>
</context-param>
<mime-mapping>
<extension>less</extension>
<mime-type>text/css</mime-type>
</mime-mapping>
<mime-mapping>
<extension>woff</extension>
<mime-type>application/x-font-woff</mime-type>
</mime-mapping>
<servlet>
<servlet-name>ServletInitializer</servlet-name>
<servlet-class>init.initializer</servlet-class>
<load-on-startup>2</load-on-startup>
<multipart-config>
<location>/tmp</location>
<max-file-size>20848820</max-file-size>
<max-request-size>418018841</max-request-size>
<file-size-threshold>1048576</file-size-threshold>
</multipart-config>
</servlet>
<error-page>
<exception-type>java.lang.IllegalStateException</exception-type>
<location>/</location>
</error-page>
Here is my bean code which I have verified is returning a list of strings properly
public List<String> tagAutoComplete(Object o){
String searchString = (String) o;
List<String> results = filter(Matchers.containsString(searchString.toUpperCase()), tagSuggestions);
System.out.println("results:" + results);
return results;
}
Here is my page code
<ui:define name="content">
<h:form id="formbox">
...
<rich:autocomplete value="#{fanlist.tagInputs}" autocompleteMethod="# {fanlist.tagAutoComplete}" mode="ajax" tokens=", " minChars="3" autofill="false" style="width:200px; height:50px;"/>
...
</h:form>
</ui:define>
Nothing is returned for the auto complete even though the bean is showing results. Please help.
Read @Andrey 's comment below. As you can see I am using the version of Richfaces mentioned in the bug as a fix, so not sure what the issue is?
There is a bug in RichFaces: https://issues.jboss.org/browse/RF-11103 . Try updating to the most recent version.
Try this code, it worked for me:
<a4j:outputPanel><rich:autocomplete value="#{fanlist.tagInputs}" autocompleteMethod="#fanlist.tagAutoComplete}" valueChangeListener="#fanlist.tagValueChanged}" mode="ajax" tokens=", " minChars="3" autofill="false" style="width:200px; height:50px;"><a4j:ajax event="selectitem" /></rich:autocomplete></a4j:outputPanel>
And add this mehod to your bean in order to get theselected value:
public void tagValueChanged(ValueChangeEvent event) {
if (null != event.getNewValue()) {
System.out.println(" event.getNewValue() "+event.getNewValue());
}
}
Override style for autocomplete. Default has url that does not exist.
input.rf-au-inp {
background-image: none;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.