当前位置: 首页 > news >正文

网站建设工作情况汇报/霸屏seo服务

网站建设工作情况汇报,霸屏seo服务,上海工程建设造价信息网站,电子元器件做哪个网站好本程序对ajax的一些基础调用进行了封装,使用者只要实现具体的事件驱动程序就可以了,如本例子的doTest.js, 然后把该文件引进相对应的jsp文件里面,如test.jsptest.jspdoTest.js//测试函数////*** 请求* doAfterRequestMethodName 请求成功后的…

本程序对ajax的一些基础调用进行了封装,使用者只要实现具体的事件驱动程序就可以

了,如本例子的doTest.js, 然后把该文件引进相对应的jsp文件里面,如test.jsp

test.jsp

doTest.js

//测试函数

///

/**

* 请求

* doAfterRequestMethodName 请求成功后的要执行的函数名称

* responseTypeName ajax异步调用后返回的内容的类型,可以使responseText或者responseXml

*/

function doTestRequest(userName, userPwd, doAfterRequestMethodName, responseTypeName){

var param = setQueryString('userName',userName,'userPwd',userPwd);

sendRequest('toStrutsAjaxTest.do',param,doAfterRequestMethodName,responseTypeName);

}

//请求成功后的执行内容

function doTestAfterRequest(responseString){

var teststring = document.getElementById("testText");

teststring.value = responseString;

}

ajaxInit.js

//全局变量

var xmlHttp = false;

///

//公共函数

//创建XMLHttpRequest对象

function createXMLHttpRequest() {

if (window.XMLHttpRequest) {//Mozilla 等浏览器

xmlHttp = new XMLHttpRequest();

} else {

if (window.ActiveXObject) {// IE浏览器

try {

xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");

}

catch (e) {

try {

xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");

}

catch (e) {

}

}

}

}

if (xmlHttp.overrideMimeType) {//修改MiME类型

xmlHttp.overrideMimeType("text/xml");

}

if (!xmlHttp) {//创建XMLHttpRequest失败

window.alert("创建XMLHttpRequest失败");

return false;

}

}

//向后台发送请求的参数设置

function setQueryString(){

var param="";

for(var i=0;i

param+=arguments[i]+'='+encodeURI(arguments[i+1]);

if(i!=arguments.length-2){

param+="&";

i++;

}else{

break;

}

}

return param;

}

/**

* 发送请求

* doAfterRequestMethodName 请求成功后的要执行的函数名称

* responseTypeName ajax异步调用后返回的内容的类型,可以使responseText或者responseXml

*/

function sendRequest(requestUrl,param,doAfterRequestMethodName,responseTypeName){

createXMLHttpRequest();

xmlHttp.open('POST',requestUrl,true);

xmlHttp.setrequestheader("content-type","application/x-www-form-urlencoded");

xmlHttp.onreadystatechange= function(){regCallBack(doAfterRequestMethodName,responseTypeName);};

xmlHttp.send(param);

}

//回调函数

function regCallBack(doAfterRequestMethodName,responseTypeName){

if(xmlHttp.readyState == 4){

if(xmlHttp.status == 200){

doAfterRequest(doAfterRequestMethodName,responseTypeName);

}

}

}

//请求成功后的执行函数

function doAfterRequest(doAfterRequestMethodName,responseTypeName){

var responseString = "";

if (responseTypeName!=null){

if (responseTypeName == "responseText"){

responseString = xmlHttp.responseText;

}

if (responseTypeName == "responseXml"){

responseString = xmlHttp.responseXml;

}

}

if(doAfterRequestMethodName!=null){

eval(doAfterRequestMethodName+"('"+responseString+"')");

}

}

//

struts-config.xml

ToStrutsAjaxTestAction.java

//Created by MyEclipse Struts

// XSL source (default): platform:/plugin/com.genuitec.eclipse.cross.easystruts.eclipse_4.1.0/xslt/JavaClass.xsl

package com.jgao.ajax.test.struts.action;

import java.io.IOException;

import java.io.PrintWriter;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;

import org.apache.struts.action.ActionForm;

import org.apache.struts.action.ActionForward;

import org.apache.struts.action.ActionMapping;

/**

* MyEclipse Struts

* Creation date: 09-18-2006

*

* XDoclet definition:

* @struts.action validate="true"

*/

public class ToStrutsAjaxTestAction extends Action {

// --------------------------------------------------------- Instance Variables

// --------------------------------------------------------- Methods

/**

* Method execute

* @param mapping

* @param form

* @param request

* @param response

* @return ActionForward

* @throws IOException

*/

public ActionForward execute(

ActionMapping mapping,

ActionForm form,

HttpServletRequest request,

HttpServletResponse response) throws IOException {

String teststring = request.getParameter("userName");

teststring = teststring + "ok";

response.getWriter().write(teststring);

return null;

}

}

posted on 2006-09-19 10:11 JGAO编程随笔 阅读(900) 评论(1)  编辑  收藏

http://www.jmfq.cn/news/5113927.html

相关文章:

  • 岳阳建设银行网站/seo短视频网页入口引流免费
  • xmapp怎样做网站/交友平台
  • 四川成都网站优化/seo技术培训教程视频
  • 第三方做农产品价格数据的网站/外贸怎么找客户资源
  • 沈阳免费做网站/seo网站关键词优化哪家好
  • 深圳网站制作联系电话/百度系优化
  • 大连做网站软件/搜索关键词优化服务
  • 网站制作三站/网店运营培训
  • 长宁区网站制作/搜狗站长平台验证不了
  • 泰安做网站公司哪家好/网络销售怎么才能找到客户
  • 华企立方做网站/微营销推广平台有哪些
  • 大型网站建设翻译英文/深圳网络推广优化
  • wordpress不显示某个标签/seo培训机构
  • vps正常网站打不开/河南最近的热搜事件
  • 义乌外贸网站开发/如何制作网页游戏
  • 购物网站开发设计文档/业务员用什么软件找客户
  • 做情趣网站违法吗/滕州seo
  • 福州招聘网站有哪几个/武汉关键词包年推广
  • 云盘建设网站/电商最好卖的十大产品
  • 网站宣传怎样做不违法/app渠道推广
  • 做网站找谁/各大引擎搜索入口
  • 徐家汇网站建设/网站流量分析报告
  • 网站仿站大多少钱/引擎搜索对人类记忆的影响
  • 下载素材第三方网站是怎么做/镇江百度推广公司
  • 网站建设和推广评价指标/制作网页的流程
  • 小说网站seo排名怎么做/超链接友情外链查询
  • 企业网站 备案 网站名称/正规的网店培训机构有哪些
  • 网站搭建中单页面/广州网站开发多少钱
  • 平面设计公司名字大全/seo公司推荐推广平台
  • 男做变态手术视频网站/海外市场推广做什么的