jsp(JAVA)α¾²Ì¬µÄ¾ßÌåÉèÖùý³Ì
Ç°¼¸Ì죬ºþÄÏSEOÔÚÓÃjspдһ¸öÆóÒµÕ¾³ÌÐòµÄʱºò£¬ÒòΪҪ²Î¼ÓÏîÄ¿´ð±ç¾ºÑ¡£¬ËùÒÔ¾ÍÏëΪ×Ô¼ºÐ´µÄ³ÌÐò¸ã¼¸¸öÁÁµã£¬ÒòΪ¸ãSEO¾ÃÁË£¬²»×Ô¾õ¾Í»áÏ뵽α¾²Ì¬£¬µ«ÊÇÔڰٶȲéÁËÒ»¸öÏÂÎ磬ֻ²éµ½ÁËurlrewrite¼Ü°üµÄÏÂÔصط½£¬ºÍ¼ÜÉè·½ÃæµÄÎÄÕ£¬²¢Ã»ÓÐjsp(JAVA)α¾²Ì¬µÄ¾ßÌå²Ù×÷ʾ·¶£¬ÓеÄÒ²Ö»ÊÇ£¬µ¥Ò³ÃæµÄα¾²Ì¬µÄд·¨£¬ÕâÀïÎÒ¾ÍÖØÍ·µ½Î²¸ø´ó¼ÒÑÝʾһ±ß£¡
Ò»£ºµ½http://tuckey.org/urlrewrite/ÏÂÔØurlrewrite¼Ü°ü£¨ÍƼö2.6.0£©
¶þ£º½âѹËùÏÂÔصÄÎļþ,°Ñurlrewrite-2.6.0.jar¸´ÖƵ½ÏîÄ¿µÄWebRoot/WEB-INF/lib/Ŀ¼ÏÂ
Èý£º°Ñurlrewrite.xml¸´ÖƵ½ÏîÄ¿µÄWebRoot/WEB-INF/Ŀ¼ÏÂ
ËÄ£ºÔÚweb.xmlÎļþÖмÓÈëÒÔÏÂ
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
<init-param>
<param-name>logLevel</param-name>
<param-value>WARN</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
£¨UrlRewriteFilterÕâ¸ö¿ÉÒÔ¸ü¸Ä£¬µ«ÊÇÈç¹ûÒª¸ü¸ÄµÄ»°£¬¾ÍÁ½¸öUrlRewriteFilter¶¼Ò»Æð¸ÄΪÏàͬµÄ×Ö·û´®£¬±ÈÈç˵¶¼¸ÄΪ:aaaÒ²ÊÇ¿ÉÒԵģ¡ÆäʵÕâ¸öÔÚurlrewrite.xmlÀïÓÐ˵Ã÷£¬×Ðϸ¿´¿´¾ÍÖªµÀÁË£¡Å¶£¬ÍüÁË£¬ÉÏÃæÕâ¶Î´úÂë¼Óµ½£º</welcome-file-list>Ö®ºó£¬£©
Î壺½ÓÏÂÀ´¾ÍÊÇurlrewrite.xmlÀïÃæµÄ¹æÔòµÄд·¨ÁË
1,µ¥Ò³Ãæ¹æÔòд·¨£º£¨¼ÇµÃ²»Òª°ÑÏîÄ¿Ãûдµ½ÀïÃæÈ¥ÁË£¡£©
<rule>
<from>^/index.html</from>
<to>/index.jsp</to>
</rule>
2£¬´øÒ»¸ö²ÎµÄURL¹æÔòд·¨
°Ñ£ºshowNews.jsp?id=²ÎÊý α³É£ºshownews_²ÎÊý.html
<rule>
<from>^/shownews_(.[0-9]*).html</from>
<to>/showNews.jsp?id=$1</to>
</rule>
()ÀïÃæÊÇÕýÔò±í´ïʽ£¬×Ô¼ºÈ¥ÕÒÕÒÕâ·½ÃæµÄ֪ʶ£¬ÃÀÔª·ûºÅ$1µÄÒâ˼ÊÇÆ¥ÅäµÚÒ»¸öÕýÔò±í´ïʽ
3,´øÁ½¸ö²ÎºÍ¶à¸ö²ÎµÄURL¹æÔòд·¨
°ÑshowNews.jsp?id=²Î1&type=²Î2α³Énews-²Î1-²Î2.html
<rule>
<from>^/news-(.[0-9]*)-(.[0-9]*).html</from>
<to>/showNews.jsp?id=$1&type=$2</to>
</rule>
×¢ÒâÒ»µã£ºÓÃ&
Ïà¹ØÎĵµ£º
ºÜ¿ÉÄܽ« Groovy µ±³ÉÊÇûÓйæÔòµÄ Java ´úÂë¡£µ«Êµ¼ÊÉÏ£¬Groovy Ö»ÊǹæÔòÉÙһЩ¡£ÕâÒ»½ÚµÄÖصãÊÇʹÓà Groovy ±àд Java Ó¦ÓóÌÐòʱ¿ÉÒÔ²»Óÿ¼ÂǵÄÒ»¸ö Java ±à³ÌµÄ¾ßÌå·½Ã棺ÀàÐͶ¨Òå¡£
ΪʲôҪÓÐÀàÐͶ¨Ò壿
ÔÚ Java ÖУ¬Èç¹ûÒªÉùÃ÷Ò»¸ö String ±äÁ¿£¬Ôò±ØÐëÊäÈ룺
String value = "Hello World";
µ«ÊÇ£¬Èç¹û×ÐϸÏëÏ ......
¡¾Ò»¡¿»ùÓÚ×Ö½ÚµÄÊäÈëÁ÷
ÖµµÃ×¢ÒâµÄµØ·½ÓУº
¢ÙLevel 2µÄÊäÈëÁ÷£¬´ó¶àÊý¶¼»áÖ¸Ã÷Êý¾ÝÔ´µÄÐÎʽ£ºÀýÈçByteArray£¬File£¬Piped
¢ÚLevel 3µÄÊäÈëÁ÷£¬Ôò²»»á³öÏÖ¾ßÌåµÄÊý¾ÝÔ´Ãû×Ö£¬¶øÊÇÒÔ¹¦ÄÜÈ¡´ú£ºÀýÈçBuffered£¬LineNumber
ËùÒÔ˵Level 3µÄÊäÈëÁ÷ÊǶÔLevel 2ÊäÈëÁ÷µÄ“·â×°ºÍ¹ýÂË”¡£Êµ¼ÊÉÏLevel 2µÄÊäÈëÁ÷£¬¶¼¼ ......
jspÖÐʵÏÖÎļþÏÂÔصÄ×î¼òµ¥µÄ·½Ê½ÊÇÔÚÍøÒ³ÉÏ×ö³¬¼¶Á´½Ó£¬È磺<a href="music/abc.mp3">µã»÷ÏÂÔØ</a>¡£µ«ÊÇÕâÑù·þÎñÆ÷ÉϵÄĿ¼×ÊÔ´»áÖ±½Ó±©Â¶¸ø×îÖÕÓû§£¬»á¸øÍøÕ¾´øÀ´Ò»Ð©²» °²È«µÄÒòËØ¡£Òò´Ë¿ÉÒÔ²ÉÓÃÆäËü·½Ê½ÊµÏÖÏÂÔØ£¬¿ÉÒÔ²ÉÓãº1¡¢RequestDispatcherµÄ·½Ê½½øÐУ»2¡¢²ÉÓÃÎļþÁ÷Êä³öµÄ·½Ê½ÏÂÔØ¡£
1¡¢²ÉÓÃRe ......
Eclipse²¢²»×Ô´øGUIµÄ¿ÉÊÓ»¯¿ª·¢¹¤¾ß£¬ÄÇôÈç¹ûÒªÔÚEclipse½øÐпÉÊÓ»¯µÄGUI¿ª·¢£¬¾ÍÐèÒªÒÀ¿¿µÚÈý·½µÄ²å¼þ¡£
1. Visual Editor
Eclipse¹Ù·½ÌṩÁËÒ»¸ö½Ð×öVisual Editor(VE)µÄ¿ªÔ´GUI²å¼þ£¬¹¦ÄÜ»¹ÊDZȽÏÇ¿¡£¿ÉÒÔ¸ù¾ÝÓû§µÄ½çÃæGUIÉè¼Æ£¬×Ô¶¯Éú³ÉÏàÓ¦µÄJAVA´úÂ롣ͬÑùÒ²¿ÉÒÔͨ¹ýÏàÓ¦µÄJAVA´úÂë£¬É ......