var param={wid:wid,state:validState};
$.ajax({
type:"POST",
url:"<%=basePath%>addCheckAction.action",
data:param,
dataType: "text",
success:function(msg){
if(msg=="success"){
alert("提交成功");
}else{
alert("提交失败");
}
}
});
java
public void responseWrite(String msg) {
getResponse().setContentType("text/html;charset=UTF-8");
PrintWriter out = null;
try {
out = getResponse().getWriter();
out.write(msg);
} catch (IOException e) {
e.printStackTrace();
} finally {
if (out != null) {
out.close();
out = null;
}
}
}<pre name="code" class="java">public void check() {//action
responseWrite("success");
}
struts
<action name="addCheckAction" method="check" class="showPictureAction">
</action>