JSP/Servletת·¢ÓëÖض¨ÏòµÄÇø±ð
JSP/Servletת·¢ÓëÖض¨ÏòµÄÇø±ð
¾¡¹ÜHttpServletResponse.sendRedirect ·½·¨ºÍRequestDispatcher.forward ·½·¨¶¼¿ÉÒÔÈÃä¯ÀÀÆ÷»ñµÃÁíÍâÒ»¸öURLËùÖ¸ÏòµÄ×ÊÔ´£¬µ«Á½ÕßµÄÄÚ²¿ÔËÐлúÖÆÓÐןܴóµÄÇø±ð¡£
¡¡¡¡ÏÂÃæÊÇHttpServletResponse.sendRedirect ·½·¨ÊµÏÖµÄÇëÇóÖض¨ÏòÓëRequestDispatcher.forward ·½·¨ÊµÏÖµÄÇëÇóת·¢µÄ×ܽá±È½Ï£º
£¨1£©RequestDispatcher.forward ·½·¨Ö»Äܽ«ÇëÇóת·¢¸øͬһ¸öWEBÓ¦ÓÃÖеÄ×é¼þ£»¶øHttpServletResponse.sendRedirect ·½·¨²»½ö¿ÉÒÔÖض¨Ïòµ½µ±Ç°Ó¦ÓóÌÐòÖеÄÆäËû×ÊÔ´£¬»¹¿ÉÒÔÖض¨Ïòµ½Í¬Ò»¸öÕ¾µãÉϵÄÆäËûÓ¦ÓóÌÐòÖеÄ×ÊÔ´£¬ÉõÖÁÊÇʹÓþø¶ÔURLÖض¨Ïòµ½ÆäËûÕ¾µãµÄ×ÊÔ´¡£Èç¹û´«µÝ¸øHttpServletResponse.sendRedirect ·½·¨µÄÏà¶ÔURLÒÔ“/”¿ªÍ·£¬ËüÊÇÏà¶ÔÓÚÕû¸öWEBÕ¾µãµÄ¸ùĿ¼£»Èç¹û´´½¨RequestDispatcher ¶ÔÏóʱָ¶¨µÄÏà¶ÔURLÒÔ“/”¿ªÍ·£¬ËüÊÇÏà¶ÔÓÚµ±Ç°WEBÓ¦ÓóÌÐòµÄ¸ùĿ¼¡£
£¨2£©µ÷ÓÃHttpServletResponse.sendRedirect ·½·¨Öض¨ÏòµÄ·ÃÎʹý³Ì½áÊøºó£¬ä¯ÀÀÆ÷µØÖ·À¸ÖÐÏÔʾµÄURL»á·¢Éú¸Ä±ä£¬ÓɳõʼµÄURLµØÖ·±ä³ÉÖض¨ÏòµÄÄ¿±êURL£»¶øµ÷ÓÃRequestDispatcher.forward ·½·¨µÄÇëÇóת·¢¹ý³Ì½áÊøºó£¬ä¯ÀÀÆ÷µØÖ·À¸±£³Ö³õʼµÄURLµØÖ·²»±ä¡£
£¨3£©HttpServletResponse.sendRedirect ·½·¨¶Ôä¯ÀÀÆ÷µÄÇëÇóÖ±½Ó×÷³öÏìÓ¦£¬ÏìÓ¦µÄ½á¹û¾ÍÊǸæËßä¯ÀÀÆ÷È¥ÖØз¢³ö¶ÔÁíÍâÒ»¸öURLµÄ·ÃÎÊÇëÇó¡£
¡¡¡¡¾Ù¸öÀý×Ó£ºÖض¨Ïò¹ý³ÌºÃ±ÈÓиö´ÂºÅ½Ð“ä¯ÀÀÆ÷”µÄÈËдÐÅÕÒÕÅÈý½èÇ®£¬ÕÅÈý»ØÐÅ˵ûÓÐÇ®£¬ÈÓä¯ÀÀÆ÷”È¥ÕÒÀîËĽ裬²¢½«ÀîËÄÏÖÔÚµÄͨÐŵØÖ·¸æË߸øÁË“ä¯ÀÀÆ÷”¡£ÓÚÊÇ£¬“ä¯ÀÀÆ÷”ÓÖ°´ÕÅÈýÌṩͨÐŵØÖ·¸øÀîËÄдÐŽèÇ®£¬ÀîËÄÊÕµ½Ðźó¾Í°ÑÇ®»ã¸øÁË“ä¯ÀÀÆ÷”¡£¿É¼û£¬“ä¯ÀÀÆ÷”Ò»¹²·¢³öÁËÁ½·âÐźÍÊÕµ½ÁËÁ½´Î»Ø¸´£¬“ä¯ÀÀÆ÷”Ò²ÖªµÀËû½èµ½µÄÇ®³ö×ÔÀîËÄÖ®ÊÖ¡£
¡¡¡¡RequestDispatcher.forward ·½·¨ÔÚ·þÎñÆ÷¶ËÄÚ²¿½«ÇëÇóת·¢¸øÁíÍâÒ»¸ö×ÊÔ´£¬ä¯ÀÀÆ÷Ö»ÖªµÀ·¢³öÁËÇëÇ󲢵õ½ÁËÏìÓ¦½á¹û£¬²¢²»ÖªµÀÔÚ·þÎñÆ÷³ÌÐòÄÚ²¿·¢ÉúÁËת·¢ÐÐΪ¡£Õâ¸ö¹ý³ÌºÃ±È´ÂºÅ½Ð“ä¯ÀÀÆ÷”µÄÈËдÐÅÕÒÕÅÈý½èÇ®£¬ÕÅÈýûÓÐÇ®£¬ÓÚÊÇÕÅÈýÕÒÀîËĽèÁËһЩǮ£¬ÉõÖÁ»¹¿ÉÒÔ¼ÓÉÏ×Ô¼ºµÄһЩǮ£¬È»ºóÔÙ½«ÕâЩǮ»ã¸øÁË“ä¯ÀÀÆ÷”¡£¿É¼û£¬“ä¯ÀÀÆ÷”Ö»·¢³öÁËÒ»·âÐźÍÊÕµ½ÁËÒ»´Î»Ø¸´£¬ËûÖ»ÖªµÀ´ÓÕÅÈýÄÇÀï½èµ½ÁË
Ïà¹ØÎĵµ£º
//ת×Ôhttp://blog.csdn.net/zqhf8/archive/2007/07/09/1683938.aspx
1¡£ÔÀí¼ò½é
dtreeÊÇÒ»¸öÃâ·ÑµÄjavascript½Å±¾£¬Ö»Ð趨ÒåÓÐÏ޵ļ¸¸ö²ÎÊý£¬¾Í¿ÉÒÔ×ö³öƯÁÁµÄÊ÷ÐͲ˵¥¡£ÏÂÔØĿ¼£ºhttp://www.destroydrop.com/javascripts/tree/
ÒÔÏÂÊÇdtreeµÄÓ÷¨Ê¾Àý£º
1£©³õʼ»¯²Ëµ¥
<script t ......
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
--from MyEclipse, automatically generate. ......
Ò»¡¢´¦ÀíajaxÇëÇóµÄjspÎļþ£ºauto.jsp
<%@ page contentType="text/html; charset=gb2312" %>
<%
//ÉèÖÃÊä³öÐÅÏ¢µÄ¸ñʽ¼°×Ö·û¼¯
response.setContentType("text/xml; charset=UTF-8");
response.setHeader("Cache-Control","no-cache&q ......
×î½ü×öÁËÒ»¸ö×ʷѲéѯģ¿é£¬ÀïÃæÉæ¼°½«×Ê·ÑÐÅÏ¢µ¼³öWordÎĵµºÍExcelÎĵµ£¬
ÏÈ˵˵µ¼³öWordÎĵµ£º
Æäʵ¾ÍÊÇ°ÑÏìÓ¦µÄÀàÐÍÉèΪapplication/msword,È»ºó°ÑÄÚÈÝÊä³öµ½Õâ¸öÎļþ¾ÍÐÐÁË
µÚÒ»²½£º
ÏÈÔÚ×ÀÃæÉÏн¨Ò»¸öwordÎĵµ,Ë«»÷´ò¿ª£¬È»ºóÁí´æΪ.htmÎļþ£¬»á²úÉúÒ»¸öÒÔ.htm½áβµÄÎļþ
µÚ¶þ²½£º
°Ñ.htmÎļþÀ©Õ¹Ãû¸ÄΪ.jspÎļ ......