纯AJAX+Servlet (回忆)

阅读更多
几年前在前一家公司做项目的时候,ajax经常会用到,常见的ajax框架,toolkit也是了如指掌,做了对日后这些东东就在也没有关注过,这不今儿恰巧有个项目其中用AJAX实现更加快捷才得以再续前缘用了一把,做了个小小的例子,算是温故知新。


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




ajax<%=request.getContextPath()%>



name:



servlet:AjaxServlet.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);
		
   }


web.xml

 
   AjaxServlet 
   com.autobacs.servlet.AjaxServlet 
  

   
     AjaxServlet 
     /AjaxServlet
  


你可能感兴趣的:(Ajax,Servlet,Microsoft,JSP,XML)