Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

JSP/ServletµÄURLÖض¨Ïò

1.RequestDispatcher.forward() 
ÊÇÔÚ·þÎñÆ÷¶ËÆð×÷ÓÃ,µ±Ê¹ÓÃforward()ʱ,Servlet engine´«µÝHTTPÇëÇó´Óµ±Ç°µÄServlet or JSPµ½ÁíÍâÒ»¸öServlet,JSP »òÆÕͨHTMLÎļþ,Ò²¼´ÄãµÄformÌá½»ÖÁa.jsp,ÔÚa.jspÓõ½ÁËforward()Öض¨ÏòÖÁb.jsp,´ËʱformÌá½»µÄËùÓÐÐÅÏ¢ÔÚb.jsp¶¼¿ÉÒÔ»ñµÃ,²ÎÊý×Ô¶¯´«µÝ. 
µ«forward()ÎÞ·¨Öض¨ÏòÖÁÓÐframeµÄjspÎļþ,¿ÉÒÔÖض¨ÏòÖÁÓÐframeµÄhtmlÎļþ,ͬʱforward()ÎÞ·¨ÔÚºóÃæ´ø²ÎÊý´«µÝ,±ÈÈçservlet?name=frank,ÕâÑù²»ÐÐ,¿ÉÒÔ³ÌÐòÄÚͨ¹ýresponse.setAttribute("name",name)À´´«ÖÁÏÂÒ»¸öÒ³Ãæ. 
Öض¨Ïòºóä¯ÀÀÆ÷µØÖ·À¸URL²»±ä. 
Àý:ÔÚservletÖнøÐÐÖض¨Ïò 
´úÂëÄÚÈÝͨ³£ÔÚservletÖÐʹÓ㬲»ÔÚjspÖÐʹÓᣠ
public void doPost(HttpServletRequest request,HttpServletResponse response)  
throws ServletException,IOException   ...{  
    response.setContentType("text/html; charset=gb2312");  
    ServletContext sc = getServletContext();  
    RequestDispatcher rd = null;  
    rd = sc.getRequestDispatcher("/index.jsp"); //¶¨ÏòµÄÒ³Ãæ  
    rd.forward(request, response);  
}
2.response.sendRedirect() 
ÊÇÔÚÓû§µÄä¯ÀÀÆ÷¶Ë¹¤×÷,sendRedirect()¿ÉÒÔ´ø²ÎÊý´«µÝ,±ÈÈçservlet?name=frank´«ÖÁϸöÒ³Ãæ,ͬʱËü¿ÉÒÔÖض¨ÏòÖÁ²»Í¬µÄÖ÷»úÉÏ,sendRedirect()¿ÉÒÔÖض¨ÏòÓÐframe.µÄjspÎļþ. 
Öض¨ÏòºóÔÚä¯ÀÀÆ÷µØÖ·À¸ÉÏ»á³öÏÖÖض¨ÏòÒ³ÃæµÄURL 
Àý:ÔÚservletÖÐÖض¨Ïò 
´úÂëÄÚÈÝ
public void doPost(HttpServletRequest request,HttpServletResponse response)  
throws ServletException,IOException   ...{  
    response.setContentType("text/html; charset=gb2312");  
    response.sendRedirect("/index.jsp");  
}
ÓÉÓÚresponseÊÇjspÒ³ÃæÖеÄÒþº¬¶ÔÏ󣬹ÊÔÚjspÒ³ÃæÖпÉÒÔÓÃresponse.sendRedirect()Ö±½ÓʵÏÖÖض¨Î»¡£
×¢Ò⣺ 
(1).ʹÓÃresponse.sendRedirectʱ£¬Ç°Ãæ²»ÄÜÓÐHTMLÊä³ö¡£ 
Õâ²¢²»ÊǾø¶ÔµÄ£¬²»ÄÜÓÐHTMLÊä³öÆäʵÊÇÖ¸²»ÄÜÓÐHTML±»Ë͵½ÁËä¯ÀÀÆ÷


Ïà¹ØÎĵµ£º

jsp Ò³Ãæ³öÏÖÂÒÂë

´Ó html Ò³Ã渴ÖƵ½ jsp Ò³Ãæ³öÏÖÂÒÂ룺
   
       ½« html µÄ <?xml version="1.0" encoding="UTF-8"?> ¸ÄΪ jsp µÄ
    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> ¼´¿É½â¾öÎÊÌâ¡£
   ......

MysqlͨÓòéѯ²Ù×÷Àà(Jsp+servlet+javaBean+Mysql)

ÔÚÌÚ¿ÆÅàѵÁËÓÐ1¸ö°ëÔÂÁË£¬ÖÕÓÚѧÍêJSP+SERVLET+JAVABEAN+MYSQL£¬Ñ§ÁËjavaµÄµÚÒ»Ì×web½â¾ö·½°¸¡£ÀÏʦҪÇóÎÒÃÇ6ÈËÒ»×鿪ʼ×öÒ»¸ö¶©²Íϵͳ¡£Õâ¸öϵͳûÓÐʲôÌرðµÄ£¬¾Í¸úµç×ÓÉ̳ÇÊÇÒ»¸öÑùµÄ¡£ÓÉÓÚÒª¶ÔÊý¾Ý¿â×ö´óÁ¿µÄÔöɾ¸Ä²é£¬ÄǸö´úÂëÓֶ࣬ÎÒÏëÄܲ»Äܽ«Êý¾Ý¿â²Ù×÷µÄÕâÒ»²ã´ò°üÆðÀ´(SqlOperDao)£¬ÈÃÎÒ¶ÔÊý¾Ý¿â²Ù×÷£¬Óü¸Ðд ......

Java/jsp ºÃµÄÈëÃÅÎÄÕ¹²ÉÍ

ÓÃJSP¹¹½¨¶¯Ì¬ÍøÕ¾ ËïÒÔÒå ¶Å¾é
Ò»¡¢ ʲôÊÇJSP JSP(JavaServer Pages)ÊÇÓÉSun Microsystems¹«Ë¾³«µ¼¡¢Ðí¶à¹«Ë¾²ÎÓëÒ»Æð½¨Á¢µÄÒ»ÖÖ¶¯Ì¬ÍøÒ³¼¼Êõ±ê×¼£¬ÆäÍøַΪ
http://www.javasoft.com/products/jsp¡£ ÔÚ´«Í³µÄÍøÒ³HTMLÎļþ(*.htm,*.html)ÖмÓÈëJava³ÌÐòƬ¶Î(Scriptlet)ºÍJSP±ê¼Ç(tag)£¬¾Í¹¹
³ÉÁËJSPÍøÒ³(*.jsp)¡£Web· ......

jsp ¹ýÂËÆ÷ºÍ¼àÌýÆ÷

ת×Ô£ºhttp://www.blogjava.net/beansoft/archive/2007/11/09/159374.html
¼ÙÉèÓÐÒ»¸ö·Ç³£Î£ÏÕµÄÈÎÎñ, ÊǾÅËÀÒ»Éú. ÐèÒªÄã´§×ÅÕ¨Ò©°ü´Ó±±Æ½¿ª³µ×߸ßËÙ·¹ý±£¶¨È¥Ê¯¼Òׯ°Ñ¹í×ӵĵﱤ¸øÕ¨ÁË. ×¢Òâ: Õâ¸öÈÎÎñÊ®·Ö¼è¾Þ, ÓпÉÄÜ°ë·ըҩ±¬Õ¨. ËùÒÔ³ö·¢Ç°ÄãÐèÒª¿àÁ·10ÔªÒ»±¾µÄ<<Ìú²¼ÉÀ>>, »¹ÐèÒªÁ¢ÒÅÖö½»´úһϺóÊÂ. ......

È«Ãæ½âÎöjsp·¾¶ÎÊÌâ


Èç¹ûÔÚÒ»¸öÏîÄ¿ÖÐ µÄjspÖмÓÈëÒÔÉÏ´úÂë ÄÇôÊä³öµÄ½á¹û »áÊÇʲôÄØ£¿
½á¹û£º/ÏîÄ¿Ãû 
ºÇºÇ ×Ô¼ºÔ­À´ÒÔΪֻ Êǵõ½ÏîÄ¿Ãû »òÕßÖ»Êǵõ½\"/\"¿´ÁË ÕæÊDz»ÊÔ²»ÖªµÀºÇºÇ
»¹ÓÐ ½ñÌìÔÚ×öÏîÄ¿µÄʱºòÎÞÒâÖз¢ÏֵĠ
»¹ÓС°/¡± ´ú±íµÄÊÇwebÏîÄ¿µÄ¸ùĿ¼ Èç¹ûÔÚ¸ùĿ¼Ï½¨ÁËÎļþ¼Ð Ö±½Ó д³Éhref=\"p ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ