ajax+servlet

JSP:
Java代码
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ page pageEncoding="UTF-8"%>



<br>ajax<%=request.getContextPath()%> <br>



name:









<%@ page contentType="text/html; charset=UTF-8"%>
<%@ page pageEncoding="UTF-8"%>



<br>ajax<%=request.getContextPath()%> <br>



name:









servlet:AjaxServlet.java


Java代码
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, RemoteException, IOException{
doPost(req, res);
}


public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {

res.setContentType("text/xml; charset=UTF-8");
String ctrl_value = req.getParameter("parm");
PrintWriter out = res.getWriter();
String downStr="";
System.out.println("&&&&&&&&&&&&&" + ctrl_value);
out.print(11);

}

public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, RemoteException, IOException{
doPost(req, res);
}


public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {

res.setContentType("text/xml; charset=UTF-8");
String ctrl_value = req.getParameter("parm");
PrintWriter out = res.getWriter();
String downStr="";
System.out.println("&&&&&&&&&&&&&" + ctrl_value);
out.print(11);

}

web.xml

Java代码

AjaxServlet
com.autobacs.servlet.AjaxServlet



AjaxServlet
/AjaxServlet

你可能感兴趣的:(ajax+servlet)