/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.gcg.struts.action;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.MappingDispatchAction;
import com.gcg.Ajaxtree;
import com.gcg.service.Ajax;
import com.gcg.struts.form.TreeForm;
/**
* MyEclipse Struts
* Creation date: 04-01-2010
*
* XDoclet definition:
* @struts.action path="/tree" name="treeForm" input="/tree/treeadd.jsp" scope="request" validate="true"
* @struts.action-forward name="success" path="/index.jsp"
*/
public class TreeAction extends MappingDispatchAction {
/*
* Generated Methods
*/
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
private Ajax ajax;
public ActionForward add(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
TreeForm treeForm = (TreeForm) form;
return null;
}
public ActionForward ajax(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws Exception {
Long parentid = Long.parseLong(request.getParameter("id"));
Long level = Long.parseLong(request.getParameter("level").trim());
if(level==2L){
List<Map<Object,Object>> ls = ajax.getLevel2(parentid);
response.setContentType("text/xml");
response.setHeader("Cache-Control", "no-cache");
PrintWriter out=response.getWriter();
out.print(parseTreeInfoToXM(ls ,parentid ,level).toString());
out.flush();
out.close();
}else if(level == 3L){
List<Map<Object,Object>> ls = ajax.getLevel3(parentid);
response.setContentType("text/xml");
response.setHeader("Cache-Control", "no-cache");
PrintWriter out=response.getWriter();
out.print(parseTreeInfoToXM(ls ,parentid ,level).toString());
out.flush();
out.close();
}else{
System.out.println(level);
throw new IllegalArgumentException("参数level非法");
}
return null;
}
public ActionForward init(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws IOException {
List<Map<Object,Object>> ls = ajax.getLevel1();
response.setContentType("text/xml");
response.setHeader("Cache-Control", "no-cache");
PrintWriter out=response.getWriter();
StringBuffer sb = parseTreeInfoToXM(ls ,0L ,0L);
System.out.println(sb);
out.print(sb);
out.flush();
out.close();
return null;
}
public StringBuffer parseTreeInfoToXM(List ls ,Long parentid , Long level){
StringBuffer sb = new StringBuffer();
sb.append("<?xml version='1.0' encoding='UTF-8'?>");
sb.append("<trees>");
if(parentid != 0){
sb.append("<parentid>" + parentid + "</parentid>");
}
if(level != 0 ){
sb.append("<level>" + level + "</level>");
}
for(int i=0 ;i<ls.size(); ++i){
sb.append("<tree>");
Map<Object,Object> map = (Map)ls.get(i);
Boolean isHaveChild = (Boolean)map.get("isHaveChild");
if(isHaveChild == true){
sb.append("<isHaveChild>true</isHaveChild>");
}else{
sb.append("<isHaveChild>false</isHaveChild>");
}
Ajaxtree ajaxtree = (Ajaxtree)map.get("ajaxtree");
Long id = ajaxtree.getId();
sb.append("<id>" + id + "</id>");
String name = ajaxtree.getName();
sb.append("<name>" + name + "</name>");
sb.append("</tree>");
}
sb.append("</trees>");
return sb;
}
public Ajax getAjax() {
return ajax;
}
public void setAjax(Ajax ajax) {
this.ajax = ajax;
}
}
package com.gcg.serviceimpl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.gcg.Ajaxtree;
import com.gcg.AjaxtreeDAO;
import com.gcg.service.Ajax;
public class AjaxTreeService implements Ajax {
private AjaxtreeDAO ajxtreeDAO;
// public void addTreeNode(Ajaxtree ajaxtree) throws RuntimeException {
// // TODO Auto-generated method stub
// try {
// ajxtreeDAO.save(ajaxtree);
// } catch (RuntimeException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// throw e;
// }
//
// }
//
// public void deleteTreeNod(Long id) throws RuntimeException {
// // TODO Auto-generated method stub
// try {
// ajxtreeDAO.deleteByID(id);
// } catch (RuntimeException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// throw e;
// }
//
// }
//
// public List<Map<Object, Object>> getAjaxResult(Long id) throws RuntimeException {
// // TODO Auto-generated method stub
// List<Map<Object, Object>> childAllInfo = new ArrayList();
// try {
//
// List<Object> childInfo = ajxtreeDAO.getChildrens(id);
//
// for(int i=0 ;i<childInfo.size() ;++i ){
// Map<Object,Object> childSumInfo = new HashMap();
// Ajaxtree ajaxtree = (Ajaxtree)childInfo.get(i);
// Long childId = ajaxtree.getId();
// childSumInfo.put(i, ajaxtree);
//
// boolean isHaveChild = ajxtreeDAO.isHaveChild(childId);
// childSumInfo.put("isHaveChild", isHaveChild);
// childAllInfo.add(childSumInfo);
// }
// } catch (RuntimeException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// throw e;
// }
// return childAllInfo;
// }
//
// public List<Object> getPidNullInfo() throws RuntimeException {
// // TODO Auto-generated method stub
// List<Object> ls = null;
// try {
// ls = ajxtreeDAO.getPidNullIInfo();
// } catch (RuntimeException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// throw e;
// }
// return ls;
// }
// public List<Map<Object, Object>> getAjaxResultPIDisNull()
// throws RuntimeException {
// List<Map<Object, Object>> childAllInfo = null;
// try {
// childAllInfo = new ArrayList();
//
// List<Object> childInfo = ajxtreeDAO.getPidNullIInfo();
// for(int i=0 ;i<childInfo.size() ;++i ){
// Map<Object,Object> childSumInfo = new HashMap();
// Ajaxtree ajaxtree = (Ajaxtree)childInfo.get(i);
// Long childId = ajaxtree.getId();
// childSumInfo.put("ajaxtree", ajaxtree);
//
// boolean isHaveChild = ajxtreeDAO.isHaveChild(childId);
// childSumInfo.put("isHaveChild", isHaveChild);
// childAllInfo.add(childSumInfo);
// }
// } catch (RuntimeException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// throw e;
// }
// return childAllInfo;
// }
public List getLevel1() throws RuntimeException {
List<Map<Object, Object>> childAllInfo = null;
try {
childAllInfo = new ArrayList();
List<Ajaxtree> childInfo = ajxtreeDAO.getLeve1();
for(int i=0 ;i<childInfo.size() ;++i ){
Map<Object,Object> childSumInfo = new HashMap();
Ajaxtree ajaxtree = (Ajaxtree)childInfo.get(i);
Long childId = ajaxtree.getId();
childSumInfo.put("ajaxtree", ajaxtree);
boolean isHaveChild = ajxtreeDAO.isHaveChild(childId);
childSumInfo.put("isHaveChild", isHaveChild);
childAllInfo.add(childSumInfo);
}
} catch (RuntimeException e) {
// TODO Auto-generated catch block
e.printStackTrace();
throw e;
}
return childAllInfo;
}
public List getLevel2(Long id) throws RuntimeException {
List<Map<Object, Object>> childAllInfo = null;
try {
childAllInfo = new ArrayList();
List<Ajaxtree> childInfo = ajxtreeDAO.getLeve2(id);
for(int i=0 ;i<childInfo.size() ;++i ){
Map<Object,Object> childSumInfo = new HashMap();
Ajaxtree ajaxtree = (Ajaxtree)childInfo.get(i);
Long childId = ajaxtree.getId();
childSumInfo.put("ajaxtree", ajaxtree);
boolean isHaveChild = ajxtreeDAO.isHaveChild(childId);
childSumInfo.put("isHaveChild", isHaveChild);
childAllInfo.add(childSumInfo);
}
} catch (RuntimeException e) {
// TODO Auto-generated catch block
e.printStackTrace();
throw e;
}
return childAllInfo;
}
public List getLevel3(Long id) throws RuntimeException {
List<Map<Object, Object>> childAllInfo = null;
try {
childAllInfo = new ArrayList();
List<Ajaxtree> childInfo = ajxtreeDAO.getLeve3(id);
for(int i=0 ;i<childInfo.size() ;++i ){
Map<Object,Object> childSumInfo = new HashMap();
Ajaxtree ajaxtree = (Ajaxtree)childInfo.get(i);
Long childId = ajaxtree.getId();
childSumInfo.put("ajaxtree", ajaxtree);
boolean isHaveChild = ajxtreeDAO.isHaveChild(childId);
childSumInfo.put("isHaveChild", isHaveChild);
childAllInfo.add(childSumInfo);
}
} catch (RuntimeException e) {
// TODO Auto-generated catch block
e.printStackTrace();
throw e;
}
return childAllInfo;
}
public AjaxtreeDAO getAjxtreeDAO() {
return ajxtreeDAO;
}
public void setAjxtreeDAO(AjaxtreeDAO ajxtreeDAO) {
this.ajxtreeDAO = ajxtreeDAO;
}
}
package com.gcg;
import java.util.HashSet;
import java.util.Set;
/**
* Ajaxtree entity.
*
* @author MyEclipse Persistence Tools
*/
public class Ajaxtree implements java.io.Serializable {
// Fields
private Long id;
private Ajaxtree ajaxtree;
private String name;
private Set ajaxtrees = new HashSet(0);
// Constructors
/** default constructor */
public Ajaxtree() {
}
/** minimal constructor */
public Ajaxtree(String name) {
this.name = name;
}
/** full constructor */
public Ajaxtree(Ajaxtree ajaxtree, String name, Set ajaxtrees) {
this.ajaxtree = ajaxtree;
this.name = name;
this.ajaxtrees = ajaxtrees;
}
// Property accessors
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
public Ajaxtree getAjaxtree() {
return this.ajaxtree;
}
public void setAjaxtree(Ajaxtree ajaxtree) {
this.ajaxtree = ajaxtree;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public Set getAjaxtrees() {
return this.ajaxtrees;
}
public void setAjaxtrees(Set ajaxtrees) {
this.ajaxtrees = ajaxtrees;
}
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
<class name="com.gcg.Ajaxtree" table="AJAXTREE" schema="SYSTEM">
<id name="id" type="java.lang.Long">
<column name="ID" precision="10" scale="0" />
<generator class="sequence" />
</id>
<many-to-one name="ajaxtree" class="com.gcg.Ajaxtree" fetch="join">
<column name="PID" precision="10" scale="0" />
</many-to-one>
<property name="name" type="java.lang.String">
<column name="NAME" length="50" not-null="true" />
</property>
<set name="ajaxtrees" inverse="true" lazy="true">
<key>
<column name="PID" precision="10" scale="0" />
</key>
<one-to-many class="com.gcg.Ajaxtree" />
</set>
</class>
</hibernate-mapping>
package com.gcg;
import java.util.List;
import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.LockMode;
import org.springframework.context.ApplicationContext;
import org.springframework.dao.DataAccessException;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
/**
* A data access object (DAO) providing persistence and search support for
* Ajaxtree entities. Transaction control of the save(), update() and delete()
* operations can directly support Spring container-managed transactions or they
* can be augmented to handle user-managed Spring transactions. Each of these
* methods provides additional information for how to configure it for the
* desired type of transaction control.
*
* @see com.gcg.Ajaxtree
* @author MyEclipse Persistence Tools
*/
public class AjaxtreeDAO extends HibernateDaoSupport {
private static final Log log = LogFactory.getLog(AjaxtreeDAO.class);
// property constants
public static final String NAME = "name";
protected void initDao() {
// do nothing
}
public void save(Ajaxtree transientInstance) {
log.debug("saving Ajaxtree instance");
try {
getHibernateTemplate().save(transientInstance);
log.debug("save successful");
} catch (RuntimeException re) {
log.error("save failed", re);
throw re;
}
}
public Boolean isHaveChild(Long id){
List<Integer> ls = null;
try {
String query = "select count(*) from Ajaxtree a inner join a.ajaxtrees c where c.ajaxtree.id = ? ";
ls = getHibernateTemplate().find(query ,id );
} catch (DataAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
throw e;
}
return ls.size() > 0;
}
public List<Object> getChildrens(Long id){
List<Object> ls = null;
try {
String query = "select a.ajaxtrees from Ajaxtree a where a.id = ? ";
ls = getHibernateTemplate().find(query , id);
} catch (DataAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
throw e;
}
return ls;
}
public List<Ajaxtree> getLeve1(){
List<Ajaxtree> ls = null;
try {
String query = " from Ajaxtree a where a.ajaxtree =null ";
ls = getHibernateTemplate().find(query);
} catch (DataAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
throw e;
}
return ls;
}
public List<Ajaxtree> getLeve2(Long id){
List<Ajaxtree> ls = null;
try {
String query = "select a.ajaxtrees from Ajaxtree a where a.ajaxtree =null and a.id=?";
ls = getHibernateTemplate().find(query, id);
} catch (DataAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
throw e;
}
return ls;
}
public List<Ajaxtree> getLeve3(Long id){
List<Ajaxtree> ls = null;
try {
String query = "select a.ajaxtrees from Ajaxtree a where a.ajaxtree !=null and a.id=?";
ls = getHibernateTemplate().find(query, id);
} catch (DataAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
throw e;
}
return ls;
}
public List<Object> getPidNullIInfo(){
List<Object> ls = null;
try {
String query = "select a.ajaxtrees from Ajaxtree a where a.ajaxtree=null ";
ls = getHibernateTemplate().find(query);
} catch (DataAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
throw e;
}
return ls;
}
public void delete(Ajaxtree persistentInstance) {
log.debug("deleting Ajaxtree instance");
try {
getHibernateTemplate().delete(persistentInstance);
log.debug("delete successful");
} catch (RuntimeException re) {
log.error("delete failed", re);
throw re;
}
}
public void deleteByID(Long ID) {
log.debug("deleting Ajaxtree instance");
try {
String query = "delete from Ajaxtree a where a.id = ? ";
getHibernateTemplate().bulkUpdate(query, ID);
log.debug("delete successful");
} catch (RuntimeException re) {
log.error("delete failed", re);
throw re;
}
}
public Ajaxtree findById(java.lang.Long id) {
log.debug("getting Ajaxtree instance with id: " + id);
try {
Ajaxtree instance = (Ajaxtree) getHibernateTemplate().get(
"com.gcg.Ajaxtree", id);
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public List findByExample(Ajaxtree instance) {
log.debug("finding Ajaxtree instance by example");
try {
List results = getHibernateTemplate().findByExample(instance);
log.debug("find by example successful, result size: "
+ results.size());
return results;
} catch (RuntimeException re) {
log.error("find by example failed", re);
throw re;
}
}
public List findByProperty(String propertyName, Object value) {
log.debug("finding Ajaxtree instance with property: " + propertyName
+ ", value: " + value);
try {
String queryString = "from Ajaxtree as model where model."
+ propertyName + "= ?";
return getHibernateTemplate().find(queryString, value);
} catch (RuntimeException re) {
log.error("find by property name failed", re);
throw re;
}
}
public List findByName(Object name) {
return findByProperty(NAME, name);
}
public List findAll() {
log.debug("finding all Ajaxtree instances");
try {
String queryString = "from Ajaxtree";
return getHibernateTemplate().find(queryString);
} catch (RuntimeException re) {
log.error("find all failed", re);
throw re;
}
}
public Ajaxtree merge(Ajaxtree detachedInstance) {
log.debug("merging Ajaxtree instance");
try {
Ajaxtree result = (Ajaxtree) getHibernateTemplate().merge(
detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
}
public void attachDirty(Ajaxtree instance) {
log.debug("attaching dirty Ajaxtree instance");
try {
getHibernateTemplate().saveOrUpdate(instance);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public void attachClean(Ajaxtree instance) {
log.debug("attaching clean Ajaxtree instance");
try {
getHibernateTemplate().lock(instance, LockMode.NONE);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public static AjaxtreeDAO getFromApplicationContext(ApplicationContext ctx) {
return (AjaxtreeDAO) ctx.getBean("AjaxtreeDAO");
}
}
}
<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script type="text/javascript" language="JavaScript">
var xmlrequest;
function createXMLHttpRequest()
{
if(window.XMLHttpRequest)
{ //Mozilla 浏览器
xmlrequest = new XMLHttpRequest();
}
else if (window.ActiveXObject)
{
// IE浏览器
try
{
xmlrequest = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
xmlrequest = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
}
}
}
}
function initNav() {
createXMLHttpRequest();
var uri = "${pageContext.request.contextPath}/ajaxInitTree.do";
xmlrequest.open("POST", uri, true);
xmlrequest.setRequestHeader("Content-Type"
, "application/x-www-form-urlencoded");
xmlrequest.onreadystatechange = processResponse;
xmlrequest.send(null);
}
function processResponse(){
if (xmlrequest.readyState == 4)
{
// 判断对象状态
if (xmlrequest.status == 200)
{
// 信息已经成功返回,开始处理信息
var doc = xmlrequest.responseXML;
var trees = doc.getElementsByTagName("tree");
// alert(trees.length);
for(var i=0;i<trees.length;++i){
var ishavechild = trees.item(i).getElementsByTagName('isHaveChild').item(0).firstChild.nodeValue;
var id = trees.item(i).getElementsByTagName('id').item(0).firstChild.nodeValue;
var name = trees.item(i).getElementsByTagName('name').item(0).firstChild.nodeValue;
var parentid = 0;
var level = 1;
createTree(parentid ,ishavechild , id , name ,level);
}
}
else
{
//页面不正常
window.alert("您所请求的页面有异常。");
}
}
}
function createTree(parentid ,ishavechild , id ,name ,level){
if(parentid == 0){
var level = level + 1;
var vdiv = document.createElement("div");
vdiv.setAttribute("id",id);
if(ishavechild == 'true'){
vdiv.innerHTML ="<div id="+'node'+id+''+level+''+">"+
"<a href="+'javascript:expandtree('+id+','+level+');>' +
"<img id="+'img'+id +' '+level+ " src='img/plus.gif'>" +
"</a>"+
"<img id="+'folder'+id+' '+level+" src='img/folder.gif'>"+
"<a href="+'javascript:expandtree('+id+','+level+');>'+name+"</a>"+
"</div>";
}else{
vdiv.innerHTML ="<div class='node'>"+
"<img src='img/folder.gif' id='folder'"+id+">"+
"<a href='#'>"+name+"</a>"+
"</div>";
}
document.getElementById("nav").appendChild(vdiv);
}else{
var parentDiv = document.getElementById('node'+parentid+''+level);
var level =parseInt(level) + 1;
alert(parentDiv.innerHTML);
var vdiv = document.createElement("div");
vdiv.setAttribute("id",id);
if(ishavechild == 'true'){
vdiv.innerHTML ="<div id="+'node'+id+''+level+''+">"+
"<a href="+'javascript:expandtree('+id+','+level+');>' +
"<img id="+'img'+id +' '+level+ " src='img/plus.gif'>" +
"</a>"+
"<img id="+'folder'+id+' '+level+" src='img/folder.gif'>"+
"<a href="+'javascript:expandtree('+id+','+level+');>'+name+"</a>"+
"</div>";
}else{
vdiv.innerHTML ="<div class='node'>"+
"<img src='img/folder.gif' id='folder'"+id+">"+
"<a href='#'>"+name+"</a>"+
"</div>";
}
parentDiv.appendChild(vdiv);
}
}
function expandtree(parentid ,level){
createXMLHttpRequest();
var uri = "${pageContext.request.contextPath}/ajaxAppendTree.do?id="+parentid+"&level="+level;
xmlrequest.open("POST", uri, true);
xmlrequest.setRequestHeader("Content-Type"
, "application/x-www-form-urlencoded");
xmlrequest.onreadystatechange = processExpandtree;
xmlrequest.send(null);
}
function processExpandtree(){
if (xmlrequest.readyState == 4)
{
// 判断对象状态
if (xmlrequest.status == 200)
{
// 信息已经成功返回,开始处理信息
var doc = xmlrequest.responseXML;
var trees = doc.getElementsByTagName("tree");
var parentid = doc.getElementsByTagName("parentid").item(0).firstChild.nodeValue;
var level = doc.getElementsByTagName("level").item(0).firstChild.nodeValue
// alert(trees.length);
for(var i=0;i<trees.length;++i){
var ishavechild = trees.item(i).getElementsByTagName('isHaveChild').item(0).firstChild.nodeValue;
var id = trees.item(i).getElementsByTagName('id').item(0).firstChild.nodeValue;
var name = trees.item(i).getElementsByTagName('name').item(0).firstChild.nodeValue;
createTree(parentid ,ishavechild , id ,name ,level);
}
}
else
{
//页面不正常
window.alert("您所请求的页面有异常。");
}
}
}
</script>
<title>AJAX 树</title>
</head>
<body onload="initNav()">
<div id="nav">
</div>
</body>
</html>
分享到:
相关推荐
很不错的Ajax开发草考文档,方便快捷1. AJAX介绍AJAX是一种运用JavaScript和可扩展标记语言(XML),在网络浏览器和服务器之间传送或接受数据的技术。2. AJAX实例AJAX可以用来创建更多交互式的网络应用程序。3. AJAX源...
Java AJAX(Asynchronous JavaScript and XML)分页与JSP(JavaServer Pages)相结合,可以提供无需刷新整个页面即可动态加载更多内容的能力,提高用户体验。本教程将深入探讨如何使用AJAX、JavaScript以及MySQL...
**Ajax 概述** Ajax(Asynchronous JavaScript and XML)是一种在无需刷新整个网页的情况下,能够更新部分网页的技术。它的核心是利用JavaScript与服务器进行异步数据交换,通过XML或者JSON格式传输数据,使得用户...
本卷从最易于理解和使用的那部分入手,介绍ASP.NET AJAX框架中能够与传统ASP.NET无缝对接的服务器端部分,包括服务器端ASP.NET AJAX Extensions与ASP.NET AJAX Control Toolkit。这部分内容不需要读者有任何的客户端...
在IT行业中,jQuery和Ajax是两个非常重要的技术,它们在构建动态、交互性强的Web应用程序时发挥着关键作用。jQuery是一个高效、简洁的JavaScript库,它简化了HTML文档遍历、事件处理、动画以及Ajax交互。Ajax...
"AJAX原理与技术的深入分析" AJAX(Asynchronous JavaScript and XML)是一种异步通信技术,允许Web应用程序异步地从服务器请求数据,而不需要重新加载整个网页。下面我们将深入分析AJAX的原理、技术、意义和发展...
**Ajax Interceptor:深入理解与应用** Ajax Interceptor 是一款专为谷歌浏览器(Chrome)设计的插件,它允许开发者在Ajax请求发送后和响应返回前进行干预,从而实现对AJAX请求数据的修改。这款插件对于前端开发、...
**AjaxRequest(Ajax使用包)** Ajax,全称Asynchronous JavaScript and XML(异步JavaScript和XML),是一种在无需重新加载整个网页的情况下,能够更新部分网页的技术。AjaxRequest是实现Ajax功能的一个工具包,它...
Android Webview虽然提供了页面加载及资源请求的钩子,但是对于h5的ajax请求并没有提供干涉的接口,这意味着我们不能在webview中干涉javascript发起的http请求,而有时候我们确实需要能够截获ajax请求并实现一些功能...
《Professional Ajax, 2nd Edition》是一本深入探讨Ajax技术的专业书籍,由三位作者Nicholas C. Zakas、Jeremy McPeak和Joe Fawcett共同撰写。本书在2007年由Wiley Publishing, Inc.出版,是针对网站开发、设计以及...
《Head Rush Ajax》是一本专为想要深入理解Ajax技术的开发者编写的书籍。Ajax,全称为"Asynchronous JavaScript and XML",并非一种单一的技术,而是一种综合了多种Web开发技术的运用方式,它允许网页在不刷新整个...
**Ajax+JSON 实例详解** 在现代Web开发中,AJAX(Asynchronous JavaScript and XML)技术已经成为提升用户体验的重要工具,它允许网页在不刷新整个页面的情况下与服务器进行数据交互。结合JSON(JavaScript Object ...
**Ajax(Asynchronous JavaScript and XML)技术是一种在无需重新加载整个网页的情况下,能够更新部分网页的技术。它通过在后台与服务器进行少量数据交换,使网页实现异步更新。这种技术可以提升用户体验,因为它...
标题中的“php+ajax例子”指的是使用PHP服务器端语言与AJAX(Asynchronous JavaScript and XML)客户端技术结合的示例应用。在Web开发中,PHP通常用于处理服务器端逻辑,而AJAX则允许网页在不刷新整个页面的情况下,...
本书重点介绍Ajax及相关的工具和技术,主要内容包括XMLHttpRequest对象及其属性和方法、发送请求和处理响应、构建完备的Ajax开发工具、使用JsUnit测试JavaScript、分析JavaScript调试工具和技术,以及Ajax开发模式和...
现在Ajax在Web项目中应用广泛,几乎可以说无处不在,这就带来另外一个问题:当Ajax请求遇到Session超时,应该怎么办? 显而易见,传统的页面跳转在此已经不适用,因为Ajax请求是XMLHTTPRequest对象发起的而不
**ASP.NET AJAX 全面解析** ASP.NET AJAX(Asynchronous JavaScript and XML)是微软为.NET Framework提供的一种技术,用于创建富交互式、响应快速的Web应用程序。它将JavaScript库(MicrosoftAjax.js)与服务器端...
2. **事件处理**:库内部监听`ajaxStart`、`ajaxSend`、`ajaxSuccess`、`ajaxError`等事件,提供了对Ajax请求生命周期的控制。开发者可以通过自定义事件处理器来扩展功能或处理错误。 3. **内容替换**:默认情况下...
Struts2与Ajax 的实现原理,于Servlet+Ajax原理是一致的,都是通过后台的response.getWriter().print("");把数据传输给前台的。 前台Ajax格式如下(需要导入ajax库,比如:jquery-1.11.3.js) 格式: $(function()...