˵˵servlet(Ò») - ÖйúWEB¿ª·¢ÕßÍøÂç (http://www.webasp.net) -- ¼¼Êõ½Ì³Ì (http://www.webasp.net/article/) --- ˵˵servlet(Ò») (http://www.webasp.net/article/18/17220.htm) |
| -- ×÷ÕߣºÎ´Öª -- ·¢²¼ÈÕÆÚ£º 2005-03-28 |
| 1.ÒªÓÃservletÊ×ÏÈÒªÔÚapplicationÖÐÒýÈëservlet.jar
2.È»ºóÒªÔÚ.javaÎļþÖÐ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServlet; import javax.servlet.ServletException; import java.io.IOException; import java.io.PrintWriter; //Õâ¾äimport¿ÉÊÓ¾ßÌåÇé¿öÒýÈë 3.½éÉÜÒ»ÏÂservletÖеö³£Óõķ½·¨ a) protected void service(HttpSerlvetRequest req,HttpServletResponse res) throws ServletException,IOException{} Èç¹û±»overwriteÁË£¬Ôò¿ÉÄܲ»»áµ÷ÓÃdoXXX method¡£ b)protected void doGet(HttpSerlvetRequest req,HttpServletResponse res) throws ServletException,IOException{} ÌØÕ÷1£ºsafe and idempotent. 2£ºOnly ASCII (text) data can be sent to server with GET method. 3£ºeasy to bookmarks. Ö÷Òª×÷Ó㺻ñÈ¡Êý¾Ý£¬¶ÔÊý¾Ý²»×÷¸Ä±ä c)protected void doPost(HttpSerlvetRequest req,HttpServletResponse res) throws ServletException,IOException{} ÌØÕ÷1£ºnot safe and idempotent. 2disallow bookmarks. Ö÷Òª×÷Ó㺴«Êäform data£¬´óÅúÁ¿µÄÊý¾Ý£¬³£ÓÃÔÚbbsµÈ¿É¸Ä±äÊý¾Ý´æ´¢µÄµØ·½ »¹ÓÐһЩ¶«Î÷Ï´ÎÔÙ½²°É |
| webasp.net |