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 ½øÐÐÑ»·
ͬ´ó¶àÊý½Å±¾ÓïÑÔÒ»Ñù£¬Groovy ¾³£±»Ðû´«ÎªÉú²úÁ¦¸ü¸ß µÄ Java ÓïÑÔÌæ´úÆ·¡£ÄúÒѾ¿´µ½ÁË Groovy ȱÉÙÀàÐÍÄܹ»ÈçºÎ¼õÉÙ´ò×Ö¹¤×÷¡£ÔÚÕâÒ»½Ú£¬½«´´½¨²¢ÊÔÓÃÒ»¸ö repeat º¯Êý¡£ÔÚÕâ¸ö¹ý³ÌÖУ¬½«½øÒ»²½Ì½Ë÷ Groovy Ìá¸ßЧÂʵķ½Ê½¡£
¸üºÃ¡¢¸ü¶ÌµÄÑ»·
ÏÂÃæÕâÖÖ·½·¨¿ÉÒÔ¸üºÃµØ¸ÐÊÜ Groovy ȱ·¦ÀàÐ͵ĺà ......
1¡¢²âÊÔ·½·¨ÈçÏ£º
public static String toUtf8(String str) {
return new String(str.getBytes("UTF-8"),"UTF-8"):
&nb ......
¿´ÁËÒ»¶Î±±·çÍøµÄÊÓƵ£¬×ܽἸ¸ö¾µäµÄjavaÏÝÚå¸ø´ó¼Ò¡£
´ð°¸ÔÚ²©¿ÍÖУºhttp://blog.csdn.net/ol_beta/archive/2010/05/17/5598867.aspx
»¶Ó´ó¼ÒÌÖÂÛ£¡
1¡¢ÕÒÆæÊý£º
Java code
public static boolean isOdd(int i){
return i % 2 == 0;
}
ÉÏÃæµÄ·½·¨ÕæµÄÄÜÕÒµ½ËùÓеÄÆæÊýô£¿
2¡¢¸¡µãÊýÏë¼õ
Jav ......
Ã÷ÌìÓÐÒ»¸öеľÍÒµ°à¿ª¿ÎÁË£¬ÓеÄͬѧ¾ö¶¨×ª°à£¬×Ô¼ºÐÄÀïҲͦì¶ÜµÄ£¬ÓÌÔ¥²»¾ö£¡
È¥¿ÉÒÔÈÃ×Ô¼º¶Ô»ù´¡¸ü¼ÓÊìÁ·£¬±Ï¾¹ËùÓеÄ֪ʶ¶¼ÊÇж«Î÷£¬Èç¹ûÓиü¶àµÄʱ¼äÁ·Ï°£¬Ð§¹ûÒ»
¶¨¸üºÃ£¡²»È¥ÊǾõµÃÔÀí¶¼¶®µÃÁË£¬Ö»Òª¼á³ÖÉÏÍêʣϵĿγ̣¬¿ÉÒÔÔÙÈ¥ÂýÂýÁ·Ï°´úÂ룬ûÓÐ
±ØÒªÀË·Ñʱ¼ä£¿ºÃì¶Ü£¬Ã÷ÌìÕÒÕÅÀÏʦ×ÉѯÏÂ....
½ñ ......
javascriptдjavaû¹Øϵ,ÖÁÓÚΪʲôÃû×ÖÕâôÏà½ü,¿ÉÄÜÊÇÒòΪjavaºÜÓÐÃûÆøËùÒÔ°ÑÃû×ÖÈ¡³É²î²»¶àµÄ,Ò»ÖÖÐÂÓïÑÔ¸Õ³öÀ´µÄʱºòÒªµãÃûÆøÀ´³öÃû°É~~
javascriptËãÊÇÒ»ÖÖhtml½Å±¾ÄÜÖ±½ÓÖ´ÐеÄÓïÑÔ°É,jspÒª±àÒë²ÅÄÜÖ´ÐÐ,Äã×Ô¼ºÐ´¸öJSP²»¿ªtomcatÖ®ÀàµÄÊÇÎÞ·¨Ö´ÐеÄ.JSPºÍJAVAµÄÇø±ð,JSPËãÊÇJAVAÒ»ÖÖ¼¼Êõ°É,ÓÃÔÚÍøÒ³±à³ÌÉÏ,ÒòΪJAVA² ......