我按照richfaces的介绍
把他们所需要的几个包加入到classpath
ui-api;ui-impl;core-api;core-impl;
在web.xml和face-config.xml里面没有任何额外的配置,
可是发现在页面用a4j标签没有任何作用,不知道什么原因,有没有用过的人指点一下啊?
我的页面如下:<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:ui="http://java.sun.com/jsf/facelets" 
      xmlns:h="http://java.sun.com/jsf/html" 
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:t="http://myfaces.apache.org/tomahawk">
<head>
        <title>MyTest.xhtml</title>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
        <script src="js/jquery-1.5.1.min.js"></script>
        <script>
        <!--
        
        window.onload = function() {
        
          //  test();
        }
        
        
        //-->
        </script>
    </head>
    
    <h:body>
      <h:form>
      
        <table align="center">
            <tr>
                <td>用户名:</td>
                <td><t:inputText forceId="true" id="emailPre" value="#{userInfo.emailPre}" >
                    <a4j:ajax event="keyup" render="outtext"  />
                </t:inputText> @ 
                <t:selectOneMenu id="menu1" value="#{userInfo.emailSuf}">
                    <t:selectItems value="#{userInfo.emailSufList}" var="suf" itemLabel="#{suf}" itemValue="#{suf}" />
                </t:selectOneMenu>
                <h:outputText id="outtext" value="#{userInfo.emailPre}" />
                </td>
            </tr>
            <tr>
                <td>密码: </td>
                <td><t:inputText forceId="true" value="#{userInfo.passWord}"/> </td>
            </tr>
            <tr>
                <td></td>
                <td></td>
            </tr>
        </table>
      </h:form>
    </h:body>
</html>web.xml配置如下:<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">    <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>    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>    <context-param>
        <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
        <param-value>.xhtml</param-value>
    </context-param>    <welcome-file-list>
        <welcome-file>index.jsf</welcome-file>
    </welcome-file-list></web-app>
在页面中有一个 <a4j:ajax event="keyup" render="outtext"  />
应该是ajax修改id为outtext的框显示(在keyup)的时候,是按照richfaces的例子做的,没有效果,不知道什么原因。
用的ide是myeclipse 8.5

解决方案 »

  1.   

    问题已解决!richfaces 4一定要用h:head 和 h:body
      

  2.   

    请问,richfaces4一直提示Caused by: java.lang.ClassNotFoundException: com.google.common.base.Function,可是已经加入了richfaces4官方说明的三个包。不知道楼主那边是怎么配的
      

  3.   

    我找到了这个包
    是guava-r08这个包
    你引入看看是不是不报错了~
      

  4.   

    您好,请问你的keyup是否是框中输入数据,立马就显示?