JSPÖÐ404´íÎóµÄ½â¾ö
404´íÎóÊÇʲôʱºò²úÉúµÄÄØ£¿µ±ÎÒÃÇͨ¹ýä¯ÀÀÆ÷ÇëÇó·þÎñÆ÷ÉϵÄij¸ö×ÊÔ´µÄʱºò£¬¿ÉÄÜÊÇJSP£¬Ò²¿ÉÄÜÊÇServlet£¬Èç¹ûÒª·ÃÎʵÄ×ÊÔ´²»´æÔÚ£¬¾Í»á²úÉú404´íÎó£¬404´íÎó¿ÉÄÜÊÇÓ¦Óñ¾ÉíµÄÎÊÌ⣬ÀýÈçûÓÐÕý³£²¿Êð¡¢Ãû×Öд´íÁË£¬Ò²¿ÉÄÜÊÇÎļþµÄÎÊÌ⣬JSPÎļþ²»´æÔÚ¡¢Ãû×Ö´íÎ󣬻òÕßServleûÓÐÅäÖá£
¸ù¾ÝÕâЩÇé¿ö£¬404´íÎóµÄ½â¾ö·½·¨ÈçÏ£º
1¡¢ webÓ¦ÓÃûÓв¿Êð³É¹¦£º´Ó¿ØÖÆ̨(http://localhost:7001/console)µÄdeploymentsÏÂÃæ¿´£¬Òª×¢Òâ״̬¡£Èç¹ûûÓв¿Êð³É¹¦£¬¿ÉÒÔµ½¿ØÖÆ̨£¨Æô¶¯·þÎñÆ÷µÄÃüÁîÐд°¿Ú£©²é¿´´íÎó¡£Èç¹ûʹÓÃÁËTomcat£¬Ôòͨ¹ýhttp://localhost:8080£¬ÔÙÑ¡Ôñ¹ÜÀí½çÃæ¡£
2¡¢ WebÓ¦ÓõÄÃû×Ö£¨Êµ¼ÊÉÏÊÇ·ÃÎÊ·½Ê½£¬Í¨³£ÊÇcontext-root£©£¬²é¿´·½Ê½£ºÔÚ¹¤³ÌÉϵãÓÒ¼ü£¬Ñ¡Ôñ“Properties”£¬Ñ¡ÔñMyEclipseàWeb£¬½çÃæÖеÄWeb Context-root.
3¡¢ ×ÊÔ´µÄÃû×Ö£¨JSPºÍservlet£©
Èç¹ûÊÇJSPÎļþ£¬×Ðϸ¿´ÎļþÃû×ÖÊÇ·ñд´í¡££¨ÔÚMyEclipseÖпª·¢µÄʱºò£¬JSPÎļþ·ÅÔÚweb-rootÖУ¬²»ÄÜ·Å´í£¬Èç¹ûÓÐÆäËûÎļþ¼Ð£¬·ÃÎÊ·½Ê½ÖÐҪд³öÎļþ¼Ð£©Èç¹ûûÓдíÎó£¬×Ðϸ¿´ÎļþÖÐÊÇ·ñͨ¹ýjsp:forward»òÕßjsp:includeµÈ·ÃÎÊ·½Ê½·ÃÎÊÁËÆäËûÎļþ£¬¿´ÆäËûÎļþÊÇ·ñ´æÔÚ¡£
Èç¹ûÊÇServlet£¬²é¿´web.xmlÎĵ²£º
<servlet-mapping>
<servlet-name>XXXXServlet</servlet-name>
<url-pattern>/XXXX</url-pattern>
</servlet-mapping>
ÆäÖÐurl-patternµÄÄÚÈݾö¶¨ÁË·ÃÎÊ·½Ê½¡£
Èç¹ûÕâ¸öServletµÄÅäÖÃûÓдíÎó£¬Òª²é¿´¸ÃServletÎļþÖÐÊÇ·ñ·ÃÎÊÁËÆäËûÎļþ£¬²é¿´Ëù·ÃÎʵÄÎļþÊÇ·ñ´æÔÚ¡£
4¡¢ Èç¹ûÉÏÃæÕâЩ´íÎó¶¼Ã»ÓУ¬¿ÉÄÜÊÇϵͳµÄ»º´æÎÊÌ⣬°üÀ¨¿Í»§¶Ëä¯ÀÀÆ÷ºÍ·þÎñÆ÷µÄÁÙʱÎļþ¡£½â¾ö·½·¨£ºÉ¾³ýÒ³Ã滺´æ£¬É¾³ý·þÎñÆ÷ÉϵĻº´æ£¬ÖØÐÂÆô¶¯ä¯ÀÀÆ÷£¬ÖØбàÒ빤³ÌÖØв¿Ê𣬹رÕÓ¦Ó÷þÎñÆ÷£¬ÖØÐÂÆô¶¯Ó¦Ó÷þÎñÆ÷£¬ÖØзÃÎÊ¡£
Ïà¹ØÎĵµ£º
document.getElementById("flag")ÔÚieÖУ¬jspÖеÄÔªËØûÓÐidÖµ£¬ÓÐnameֵʱ£¬Ò²Äܲé³öÀ´£¬°´ÕÕnameÖµ²é¡£
µ«ÊÇÔÚfirefoxÖУ¬Èç¹ûûÓÐidÖµ£¬Ôò²é²»³öÀ´¡£ËùÒÔieÖУ¬nameºÍidÓÐʱͨÓ㻵«ÊÇfirefoxÖУ¬ÊÇÓÐÕâÑϸñÇø±ðµÄ¡£ ......
Ê×ÏÈ,˵һÏÂ301Öض¨ÏòµÄÒâÒåÓë×÷ÓÃ(ÍøÉÏÕÒµÄÏà¹Ø×ÊÁÏ)
ÆäʵÕâ¾ÍÉæ¼°µ½ÁËSEOµÄ֪ʶ¡£
ʲôÊÇ301תÏò£¿
´ÓËÑË÷ÒýÇæÓÅ»¯½Ç¶È³ö·¢£¬301Öض¨ÏòÊÇÍøÖ·Öض¨Ïò×îΪ¿ÉÐеÄÒ»ÖÖ°ì·¨¡£µ±ÍøÕ¾µÄÓòÃû·¢Éú±ä¸üºó£¬ËÑË÷ÒýÇæÖ»¶ÔÐÂÍøÖ·½øÐÐË÷Òý£¬Í¬Ê±ÓÖ»á°Ñ¾ÉµØÖ·ÏÂÔÓеÄÍⲿÁ´½ÓÈçÊýתÒƵ½ÐµØÖ·Ï£¬´Ó¶ø²»»áÈÃÍøÕ¾µÄÅÅÃûÒòΪÍøÖ ......
ÔÚJava web¿ª·¢Öг£»áʹÓõ½¹¦ÄÜÇ¿´óµÄ¹ýÂËÆ÷£¬Ëû±Ï¾¹ÄܸøÎÒÃÇ´øÀ´ºÜ´óµÄ·½±ã£¬µ«ÊÇÕë¶Ô¹ýÂ˵Ä×ÊÔ´ÎÒÃÇÐèÒªÏêϸµÄÁ˽âËûÃÇÔÚweb.xmlÖеÄÅäÖÃÐÅÏ¢¡£Õâ¸ö¸ù¾Ý¼¸ÖÖ³£ÓõIJ»Í¬Çé¿ö½øÐÐÁË×ܽ᣺
1.Èç¹ûÒªÓ³Éä¹ýÂËÓ¦ÓóÌÐòÖÐËùÓÐ×ÊÔ´£º
<filter>
<filter-name>loggerfilter</filter-name> ......
ÔÚJspÖе÷ÓÃSerlvetÖÐÒѾ´æ´¢ÁËÐÅÏ¢µÄ JavaBean.
ServletÖÐÒѾ°ÑÊý¾Ý¿âµÄÐÅÏ¢±£´æµ½JavaBeanÖÐ,ÔÙ°ÑJavaBean±£´æµ½SessionÖÐ.
Jsp¿ªÊ¼µ÷ÓÃ:
<jsp:useBean id="key" type="ClassName" scope="Session" />
<jsp:getProperty name="key" property="PropertyName" />
ÎÞ·¨¶Á³öÐÅÏ¢:
ÔÒò: JavaBean ÖÐÊôÐÔµ ......