81,094
社区成员
发帖
与我相关
我的任务
分享
<?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>
<?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