JavaEE5  Email:su 1. JSF AJAX ajax4jsf AJAX JSF JSF
JSP JSF
12-JSF ᬫŝAJAX Ü/ȃ  ᐪ
mail:suhuanzheng7784877@163
4jsf JSF AJAX
JSF ajax4jsf ajax4jsf ajax4jsf js html js ajax
JSF
4jsf
ajax
ax
2.ajax4jsf-1.1.1.jar
www.java2s/Code/Jar/JKL/Downloadajax4jsf111jar.htm jar
jar
java笔记总结
commons-beanutils.jar
commons-collections.jar
commons-digester.jar
commons-logging.jar
oscache-2.4.1.jar
l
<!--JSF ajax AJAX4JSF-->
<filter>
<display-name>Ajax4jsf Filter</display-name>
<filter-name>ajax4jsf</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
</filter>
<filter-mapping>
<filter-name>ajax4jsf</filter-name>
<servlet-name>Faces Servlet</servlet-name>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
servler Faces Servlet Faces Servlet JSF javax.faces.webapp.FacesServlet org.ajax4jsf.Filter ajax4jsf-1.1.1.jar
ajax filter request forward request include request JSF
4.AJAX
<%@page language="java"pageEncoding="UTF-8"%>
<%@taglib uri="java.sun/jsf/html"prefix="h"%>
<%@taglib uri="java.sun/jsf/core"prefix="f"%>
<%@ taglib uri="ajax4jsf.dev.java/ajax" prefix="a4j" %> <head>
<title></title>
</head>
<body>
<f:view>
<a4j:region id="a4j_2">
<h2>
</h2>
<h:form id="loginForm">
<h:panelGrid columns="3">
<h:outputLabel value=""></h:outputLabel>
<h:inputText id="txtUserName"
value="#{UserBean.userName}">
<a4j:support
actionListener="#{UserBean.validateUserName}"
event="onblur"
reRender="result"></a4j:support>
</h:inputText>
<h:panelGroup>
<h:message for="txtUserName"></h:message>
<h:outputText value="#{UserBean.validUserMsg}" id="result"
/>
</h:panelGroup>
<h:outputLabel value=""></h:outputLabel>
<h:inputSecret id="txtPwd"
value="#{UserBean.password}"></h:inputSecret>
<h:message for="txtPwd"></h:message>
<h:outputLabel value=""></h:outputLabel>
<h:panelGroup>
<h:inputText id="txtCode"
value="#{de}" size="10"/>
<a4j:outputPanel id="detail_media">
<a4j:commandLink reRender="detail_media">
<a4j:mediaOutput element="img"
cacheable="false"
session="false"
createContent="#{UserBean.paint}"
value="#{imageData}"
mimeType="image/jpeg" border="0" />
</a4j:commandLink>
</a4j:outputPanel>
</h:panelGroup>
<h:outputText value="#{UserBean.validateCodeMsg}"
/>
</h:panelGrid>
<h:panelGrid columns="3">
<h:outputLabel value=""></h:outputLabel>
<h:inputText id="myname"value="#{ame}">
<a4j:support
actionListener="#{UserBean.isHaveName}"
event="onblur"
reRender="result2"></a4j:support>
</h:inputText>
<h:panelGroup>
<h:message for="myname"></h:message>
<h:outputText value="#{UserBean.validUserMsg}" id="result2"
/>
</h:panelGroup>
</h:panelGrid>
<h:commandButton action="#{UserBean.login}" value=""
/
>
</h:form>
</a4j:region>
</f:view>
</body>
</html>
1):ajax ajax4jsf
<%@ taglib uri="ajax4jsf.dev.java/ajax" prefix="a4j" %>
2):ajax
<a4j:region id="a4j_2"></a4j:region>
AJAX
3):ajax ajax
JSF
<a4j:support actionListener="#{UserBean.validateUserName}"
event="onblur" reRender="result"></a4j:support>
4):ajax4jsf ajax
<a4j:outputPanel id="detail_media">
<a4j:commandLink reRender="detail_media">
<a4j:mediaOutput element="img" cacheable="false"
session="false" createContent="#{UserBean.paint}"
value="#{imageData}" mimeType="image/jpeg"
border="0" />
</a4j:commandLink>
</a4j:outputPanel>
5.Bean
/**
*  ClassName: UserBean.java
*  created on Nov 1, 2007
*  Copyrights 2007-2008 qjyong All rights reserved.
*  EMail: qjyong@gmail
*/
package ajax;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Random;
import t.FacesContext;
import javax.faces.event.ActionEvent;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpSession;
/**
* @author qiujy
* @version 1.0
*
*/
public class UserBean {

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。