rich:自动填充功能未在浏览器中显示

时间:2015-12-15 07:50:28

标签: jsf richfaces

我正在做Rich Faces教程,我完成了代码但是当我部署项目时,浏览器中没有出现rich:autocomplete框,我尝试了不同的浏览器,但仍然是相同的< / p>

这是我的代码 test.xhtml

 <body>
    <rich:panel>
        <f:facet name="header">
        Richfaces sample validation and auto-completion Updated
        </f:facet>
        <h:form>
            <h:outputText value="Enter your name" />
            <h:inputText id="name" value="#{UserBean.name}">
                <rich:validator />
            </h:inputText>

            <rich:message for="name" />
            <br />

            <h:outputText value="Enter your state" />
            <rich:autocomplete mode="ajax" showButton="true" value="#{UserBean.state}" minChars="1"
                autocompleteMethod="#{UserBean.autocomplete}" />
        </h:form>
    </rich:panel>
</body>

UserBean.java代码

    @ManagedBean
public class UserBean {

    public List<String> autocomplete(String prefix) {

        ArrayList<String> result = new ArrayList<String>();
        result.add("England");
        result.add("France");
        result.add("Germany");
        result.add("Italy");
        result.add("Spain");

        return result;
    }

    @Size(min=3, max=12,message="Must be between 3 and 12 chars")
    private String name;

    private String state;

    public String getState() {
        return state;
    }

    public String getName() {
        return name;
    }

}

这是&#39; web.xml&#39;

    <?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>rich</display-name>
  <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>*.jsf</url-pattern>
  </servlet-mapping>
</web-app>

当我在浏览器中运行war文件时,它显示如下:

Running Project in the browser

虽然Eclipse中的实际预览显示如下:

The Eclipse Preview

0 个答案:

没有答案