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

jsp 301Öض¨ÏòµÄÒâÒ弰ʵÏÖ

 Ê×ÏÈ,˵һÏÂ301Öض¨ÏòµÄÒâÒåÓë×÷ÓÃ(ÍøÉÏÕÒµÄÏà¹Ø×ÊÁÏ)
ÆäʵÕâ¾ÍÉæ¼°µ½ÁËSEOµÄ֪ʶ¡£
ʲôÊÇ301תÏò£¿
´ÓËÑË÷ÒýÇæÓÅ»¯½Ç¶È³ö·¢£¬301Öض¨ÏòÊÇÍøÖ·Öض¨Ïò×îΪ¿ÉÐеÄÒ»ÖÖ°ì·¨¡£µ±ÍøÕ¾µÄÓòÃû·¢Éú±ä¸üºó£¬ËÑË÷ÒýÇæÖ»¶ÔÐÂÍøÖ·½øÐÐË÷Òý£¬Í¬Ê±ÓÖ»á°Ñ¾ÉµØÖ·ÏÂÔ­ÓеÄÍⲿÁ´½ÓÈçÊýתÒƵ½ÐµØÖ·Ï£¬´Ó¶ø²»»áÈÃÍøÕ¾µÄÅÅÃûÒòΪÍøÖ·±ä¸ü¶øÊÕµ½Ë¿ºÁÓ°Ï졣ͬÑù£¬ÔÚʹÓÃ301ÓÀ¾ÃÐÔÖض¨ÏòÃüÁîÈöà¸öÓòÃûÖ¸ÏòÍøÕ¾Ö÷Óòʱ£¬Ò಻»á¶ÔÍøÕ¾µÄÅÅÃû²úÉúÈκθºÃæÓ°Ïì¡£
301תÏò(»ò½Ð301Öض¨Ïò£¬301Ìøת)Êǵ±Óû§»òËÑË÷ÒýÇæÏòÍøÕ¾·þÎñÆ÷·¢³öä¯ÀÀÇëÇóʱ£¬·þÎñÆ÷·µ»ØµÄHTTPÊý¾ÝÁ÷ÖÐÍ·ÐÅÏ¢(header)ÖеÄ״̬ÂëµÄÒ»ÖÖ£¬±íʾ±¾ÍøÒ³ÓÀ¾ÃÐÔתÒƵ½ÁíÒ»¸öµØÖ·¡£
ÆäËü³£¼ûµÄ״̬Â뻹°üÀ¨£¬200±íʾһÇÐÕý³££¬404ÍøÒ³ÕÒ²»µ½£¬302ÔÝʱתÏò£¬µÈµÈ¡£
ΪʲôҪÓÃ301תÏò£¿
ÍøַתÏò·½·¨Ö÷Òª°üÀ¨£º301תÏò£¬302תÏò£¬JavaScriptתÏò£¬PHP/ASP/CGIתÏò£¬META REFRESHÍøÒ³METAˢУ¬µÈ¡£302תÏò¿ÉÄÜ»áÓÐURL¹æ·¶»¯ÎÊÌâ¡£ÆäËü·½·¨¶¼Êdz£ÓõÄ×÷±×ÊÖ·¨£¬µ±È»²»ÊÇ˵²»¿ÉÒÔÕýµ±µØÓ㬷½·¨±¾ÉíûÓÐ´í£¬µ«±»×÷±×ÕßÓöàÁË£¬ËÑË÷ÒýÇæ¶ÔÕâЩ¿ÉÒɵÄתÏò¶¼ºÜÃô¸Ð¡£ºÎ±ØðÏÕÄØ¡£
µ±ÍøÒ³AÓÃ301Öض¨Ïòתµ½ÍøÒ³Bʱ£¬ËÑË÷ÒýÇæ¿ÉÒԿ϶¨ÍøÒ³AÓÀ¾ÃµÄ¸Ä±äλÖ㬻òÕß˵ʵ¼ÊÉϲ»´æÔÚÁË£¬ËÑË÷ÒýÇæ¾Í»á°ÑÍøÒ³Bµ±×÷ΨһÓÐЧĿ±ê¡£ºÃ´¦ÊÇ£¬µÚÒ»£¬Ã»ÓÐÍøÖ·¹æ·¶»¯ÎÊÌ⣬µÚ¶þ£¬Ò²ºÜÖØÒªµÄ£¬ÍøÒ³AµÄPRÍøÒ³¼¶±ð»á´«µ½ÍøÒ³B¡£
ÔÚJSPÖÐÈçºÎÀ´ÊµÏÖÕâ¸ö301µÄתÏòÄØ£¿
ÈçÒ»Ò³Ãæarticle.sjp
[code]
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
 response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);  
response.setHeader("Location","/other.jsp");
return;
%>
[code]
ÔÚapacheÖÐÈçºÎʵÏÖ301תÏòÄØ?
±à¼­.htaccessµÄ·½·¨¡£
×¢Ò⣺ÔÚÉèÖÃ301Öض¨Ïò֮ǰÎñ±Ø±¸·ÝÏàӦĿ¼ÏµÄ.htaccessÎļþ¡£
1.Öض¨Ïòdomain.comµ½www.domain.com
ÕâÖÖÖض¨ÏòÖ¼ÔÚʹÓòÃûΨһ£¬ÊÇÍøÕ¾SEO±ØÐëÒª×öµÄ£¬ºóÃæÖض¨Ïòwww.domain.comµ½domain.comÒ²ÊdzöÓÚͬÑùµÄÔ­Òò£¬Ö»ÊÇÐÎʽ²»Í¬¡£
´ò¿ª.htaccessÎļþ£¬¼ÓÈëÒÔϹæÔò¡£(ÏÂÃæµÄ¹æÔòÊÇÕë¶ÔÖ÷ÓòÃûµÄ£¬×ÓÓòÃûÒªÐÞ¸Ä)
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
2.Öض¨Ïòwww.domain.comµ½domain.com
RewriteEngine On


Ïà¹ØÎĵµ£º

struts2ÖÐaction»ñÈ¡jspÒ³Ãæ²ÎÊý

ת×Ô£ºhttp://hi.baidu.com/346667002/blog/item/e58edef0d599fcc97831aa18.html
1. ActionContext
ÔÚStruts2¿ª·¢ÖÐ,³ýÁ˽«ÇëÇó²ÎÊý×Ô¶¯ÉèÖõ½ActionµÄ×Ö¶ÎÖÐ,ÎÒÃÇÍùÍùÒ²ÐèÒªÔÚActionÀïÖ±½Ó»ñÈ¡ÇëÇó(Request)»ò»á»°
(Session)µÄһЩÐÅÏ¢,ÉõÖÁÐèÒªÖ±½Ó¶ÔJavaServlet
HttpµÄÇëÇó(HttpServletRequest),ÏìÓ¦(HttpServletRes ......

¹ØÓÚJSPÖÐrequest.getRealPath()

ÔÚΪ·þÎñÆ÷¶Ë×é¼þ±à³Ìʱ£¬ÄãºÜ¿ÉÄÜÒª´ÓÏà¶ÔÓÚweb¸ùµÄ·¾¶À´È¡µÃij¸öÎļþµÄÕæʵ·¾¶£¬µ«´ËÎļþʵ¼ÊÉÏÔÚÕ¾µãµÄÒ»¸öÐéÄâ·¾¶ÉÏ¡£
ʲôÊÇÐéÄâ·¾¶£¿
ÔÚÒ»¸öweb·þÎñÆ÷ÉÏ£¬ÐéÄâ·¾¶½«ÎïÀíÉÏ·ÖÀëµÄ¸÷Îļþ×éºÏÔÚÒ»Æ𣬷ÅÔÚͬһ¸öÕ¾µã·¾¶ÉÏ£¬ÔÚÓ¦Ó÷þÎñÆ÷ÉÏ£¬Ã¿¸öÓ¦Óö¨Î»ÓÚÆä×Ô¼ºµÄÐéÄâ·¾¶ÉÏ£¬Êµ¼ÊÉÏÏ໥֮¼äÓÐ×ÅÍêÃÀµØ·ÖÀë¡£ ......

JSP

 1  forward ºÍredirectµÄÇø±ð
     Ò»¾ä»°£¬×ª·¢ÊÇ·þÎñÆ÷ÐÐΪ£¬Öض¨ÏòÊÇ¿Í»§¶ËÐÐΪ¡£ÎªÊ²Ã´ÕâÑù˵ÄØ£¬Õâ¾ÍÒª¿´Á½¸ö¶¯×÷µÄ¹¤×÷Á÷³Ì£º
ת·¢¹ý³Ì£º¿Í»§ä¯ÀÀÆ÷·¢ËÍhttpÇëÇó----¡·web·þÎñÆ÷½ÓÊÜ´ËÇëÇó--¡·µ÷ÓÃÄÚ²¿µÄÒ»¸ö·½·¨ÔÚÈÝÆ÷ÄÚ²¿Íê³ÉÇëÇó´¦ÀíºÍת·¢¶¯×÷----¡·½«Ä¿±ê×ÊÔ´·¢Ë͸ø¿Í»§£»ÔÚÕâÀï£ ......

JSP Standard Tag Libraries ʵ¼ùÀí½â

 ÔÚ±¾ÆªÎÄÕÂÖÐ,ÎÒÃǽ«»áÉîÈëÁ˽âÔÚ²»Í¬µÄTag LibraryÃèÊö·û(Tag Library Descriptors:TLDs)ÖÐʹÓø÷ÖÖ²»Í¬µÄtagµÄÇé¿ö.ÎÒÃǽ«»áÒÀ´ÎÑо¿ Ìõ¼þ¡¢Ñ­»·¡¢URL¡¢U18N¡¢XMLµÈtagµÄÓ÷¨¡£ÒÔ´ËÀ´Ìá¸ßÄã¶ÔJSTLµÄÈÏʶºÍÓ¦ÓÃÄÜÁ¦,ÔÚÔĶÁ±¾ÎÄÇ°£¬ÄãÓ¦¸Ã¶Ô JSP Tag LibÓÐËùÁ˽⣬²¢ÇåÎúÓйØJSTL£¨JSP Standard Tag Libraries£©µÄ»ù± ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ