jquery动态调用struts中的action

2014-11-24 02:29:13 · 作者: · 浏览: 0

---------------------------------js部分-----------------------------
function checkDbdl(){
var bblx = document.getElementById("bblx").value;
var basePath = document.getElementById("basePath").value;
var dbdlxmlpath = document.getElementById("dbdlxmlpath").value;
var bbdl = document.getElementById("dbdl").value;
$.ajax({
url: basePath+'readXmlAction_getSmallTool.action',//调用的action
data: {'strXmlPath':dbdlxmlpath },//请求的参数
success:function(msg){
$("#dbxl").html(oop+msg);
}
});
}

-----------------------------java部分------------------------------
package com.cs.webTool.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;

import com.cs.webTool.util.ReadXml;
import com.opensymphony.xwork2.ActionSupport;

public class ReadXmlAction extends ActionSupport {
public void readXml() throws Exception {

HttpServletRequest request = ServletActionContext.getRequest();
HttpServletResponse res = ServletActionContext.getResponse();
String strXmlPath = request.getParameter("strXmlPath");

res.getWriter().print(msg);
}
}
--------------------------struts配置---------------------------------