AJax¼¼Êõ

¸ßËÙÉÏÊÖXmlHttpRequest(2)

×ÖºÅ+ ×÷ÕߣºH5Ö®¼Ò À´Ô´£ºH5Ö®¼Ò 2017-06-18 13:04 ÎÒÒªÆÀÂÛ( )

´Ëʱ£¬Ó¦¸Ã´´½¨Webserver¡£Ê¹ÓÃtomcatserver´´½¨servlet /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and o

´Ëʱ£¬Ó¦¸Ã´´½¨Webserver¡£Ê¹ÓÃtomcatserver´´½¨servlet

/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * * @author ÕÔ³ç */ public class Ajax extends HttpServlet { /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); try (PrintWriter out = response.getWriter()) { /* TODO output your page here. You may use following sample code. */ String old=request.getParameter("name"); if(old==null){ out.println("username²»ÄÜΪ¿Õ"); }else{ String name=new String(old.getBytes("ISO8859-1"),"gb2312"); System.out.println(name); if(name.equals("zhaochong")){ out.println("username["+ name+"]ÒѾ­´æÔÚ¡£ÇëʹÓÃÆäËüusername"); }else{ out.println("username["+ name+"]ÉÐδ´æÔÚ£¬ÇëʹÓÃÆäËüusername"); } } } }


ÔÚ´´½¨servletµÄʱºò£¬½ö½öÐëÒª¸Ä¶¯processRequestº¯ÊýÖеÄÄÚÈÝ¡£´´½¨servletµÄʱºò£¬Çë×Ô¼ºÖ÷¶¯Éú³Éxml

   

¼¼Êõ·ÖÏí

 

   ÒÔÉÏDemoÊÇÔÚNetBean IDEÉϽøÐеġ£¾¡¹ÜÕâôһ¸öСÑùÀý¡£·¢ÏÖÀïÃæÓкö඼²»¶®¡­¡­±È·½tomcatÓëglashfishµÄ²î±ð ÒÔ¼°xmlÎļþÀïÄÚÈݵĺ¬ÒåµÈµÈ¡£

¿´ÊÓƵµÄʱºò£¬ÑÛ¿´Æ«ÁË£¬ºöÂÔÁË ¿ª·¢»·¾³µÄÅäÖá£

 

×ܽá

   Í¨¹ýÒÔÉÏÒ»¸öСÑùÀý£¬Äܹ»³õ²½Á˽âÒ»ÏÂAjaxÓ봫ͳҳÃæµÄ²î±ð¡£¸ü¼ÓÉîÈëµÄÀí½â£¬ÐëÒªÔÚ¶à´Î·´¸´£¬ÔÚÏîÄ¿ÖÐÓ¦Ó㬲ŸÉÊìÁ·ÕÆÎÕ¡£


 

 

 

¡¡

1.±¾Õ¾×ñÑ­ÐÐÒµ¹æ·¶£¬ÈκÎתÔصĸå¼þ¶¼»áÃ÷È·±ê×¢×÷ÕߺÍÀ´Ô´£»2.±¾Õ¾µÄÔ­´´ÎÄÕ£¬ÇëתÔØʱÎñ±Ø×¢Ã÷ÎÄÕÂ×÷ÕߺÍÀ´Ô´£¬²»×ðÖØÔ­´´µÄÐÐΪÎÒÃǽ«×·¾¿ÔðÈΣ»3.×÷ÕßͶ¸å¿ÉÄܻᾭÎÒÃDZ༭Ð޸Ļò²¹³ä¡£

Ïà¹ØÎÄÕÂ
  • AjaxÎÏţѧԺԭ´´²©¿Í£¬Òƶ¯»¥ÁªÍøÈ˲ŷõ»¯»ùµØ

    AjaxÎÏţѧԺԭ´´²©¿Í£¬Òƶ¯»¥ÁªÍøÈ˲ŷõ»¯»ùµØ

    2017-06-16 08:01

  • Struts2½áºÏAjaxʵÏֵǼ

    Struts2½áºÏAjaxʵÏֵǼ

    2017-05-06 13:12

  • jquery ¶ÁÈ¡Ò³Ãæload get post ajax ËÄÖÖ·½Ê½´úÂëд·¨

    jquery ¶ÁÈ¡Ò³Ãæload get post ajax ËÄÖÖ·½Ê½´úÂëд·¨

    2017-03-30 17:01

  • ÀÏÓÍÌõµÄºǫ́¿ª·¢

    ÀÏÓÍÌõµÄºǫ́¿ª·¢

    2017-02-27 14:00

ÍøÓѵãÆÀ
é