[英]rich autocomplete does not work
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" 当加载页面“ Servlet FacesServlet的Servlet.service()引发异常:java.lang.IllegalArgumentException:宽度(2000)和高度(0)不能为<= 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 我已经看到了几篇关于此的文章,所以我检查了我们的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"
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 这是我已验证的bean代码,可以正确返回字符串列表
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. 即使bean正在显示结果,也不会为自动完成返回任何内容。 Please help. 请帮忙。
Read @Andrey 's comment below. 阅读下面的@Andrey的评论。 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? 如您所见,我正在使用该错误中提到的Richfaces版本作为修复程序,所以不确定是什么问题吗?
There is a bug in RichFaces: https://issues.jboss.org/browse/RF-11103 . 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: 并将此方法添加到您的bean中以获得所选值:
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. 默认具有不存在的URL。
input.rf-au-inp {
background-image: none;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.