richfaces4+jsf2的问题(richfaces不起作用)

anyuelang 2011-04-05 09:49:09
我按照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
...全文
398 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
jcc_really 2012-04-09
  • 打赏
  • 举报
回复
您好,请问你的keyup是否是框中输入数据,立马就显示?
wekabcd 2012-01-18
  • 打赏
  • 举报
回复
请问楼主,你是怎么解决这个问题的?
anyuelang 2011-04-12
  • 打赏
  • 举报
回复
我找到了这个包
是guava-r08这个包
你引入看看是不是不报错了~
小红树 2011-04-09
  • 打赏
  • 举报
回复
请问,richfaces4一直提示Caused by: java.lang.ClassNotFoundException: com.google.common.base.Function,可是已经加入了richfaces4官方说明的三个包。不知道楼主那边是怎么配的
anyuelang 2011-04-06
  • 打赏
  • 举报
回复
问题已解决!richfaces 4一定要用h:head 和 h:body
zh2332926106 2011-04-06
  • 打赏
  • 举报
回复
a4j需要在web.xml配置一下

81,094

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧