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

ÔÚJava web·þÎñÆ÷ÄÚʹÓÃurl rewrite

ÿ¸öÍøÒ³»òÇëÇó¶¼ÊÇÒ»¸öurlµØÖ·£¬Ò»°ã£¬Õâ¸öµØÖ·¿ÉÄÜÊÇ.do,.page,.actionÖ®ÀàµÄ²¢¼ÓÉÏ'?'ºÅ¡¢'&'ºÅ²éѯ´®µÈ¹¹³ÉµÄÒ»¸ö³¤³¤µÄµÄurl¡£ºÜurgly¡£
Ò»°ãµÄurl----------------------------------------------------------½ÏºÃµÄurl
http://www.xxx.net/user/profile.do?id=20001   ====> http://www.xxx.net/user/20001
http://www.xxx.net/forum/board.do?name=java   ====> http://www.xxx.net/forum/java
http://www.xxx.net/forum/thread.do?id=29923   ====> http://www.xxx.net/thread/29923
ºóÕßÃ÷ÏÔ½ÏΪֱ¹ÛºÍƯÁÁ¡£
ʹÓÃurl rewrite¿ÉÒԺܺõĸÄÉÆÕâ¸ö×´¿ö¡£ÍøÕ¾url rewriteÓ¦ÓÃÊǷdz£¹ã·ºµÄ£¬Á¼ºÃµÄurlÉè¼Æ¸øÓû§´øÀ´µÄ·Ç³£ºÃµÄÌåÑ飬ͬʱҲÄÜÎüÒýËÑË÷ÒýÇæµÄ×¢Òâ¡£
Ò»ÖÖrewrite³ÆΪһ¸ö¹æÔò£¬ÉÏÃæµÄÀý×Ó¾ÍÊÇ3¸ö¹æÔò¡£rewrite¼¼Êõ¿ÉÒÔÔÚ´úÀí·þÎñÆ÷ʵÏÖ£¬»òÕß¿ÉÒÔÔÚtomcatÖ®ÀàµÄjava web·þÎñÆ÷ʵÏÖ¡£ Apache HTTP Server 2.x ºÍ mod_proxyÌṩÁ˲»´íµÄRewrite´¦Àí·½·¨¡£soÈç¹ûʹÓÃapache£¬ÔòÖ±½ÓÔÚapacheÖÐÅäÖÃRewrite¼´¿É¡£µ«ÊǶÔÓÚûÓÐʹÓôúÀí£¬»òÕß²»ÍêÈ«ÒªÔÚ´úÀí·þÎñÆ÷ÅäÖÃRewriteµÄwebÓ¦Óã¬Í¨¹ýµÚÈý·½Jar°üÒ²ÊÇ¿ÉÒÔʵÏÖºÜperfectµÄrewrite¼¼ÊõµÄ¡£ÕâÊDZ¾ÌûµÄ×ÅÖص㡣
Õâ¸öµÚÈý·½°üµÄµØÖ·ÊÇ£ºhttp://tuckey.org/urlrewrite/  (´ý»áÔÙÈ¥Õâ¸öÍøÕ¾£¬ÏÖÔÚÏȱðÈ¥)
Õâ¸ö°üʹÓÃÕýÔò±í´ïʽ·ÂÕÕÁËapache rewriteµÄ×ö·¨¡£¶øʵÏÖÔ­ÀíÒ²ÊǺÜÃ÷ÎúµÄ£ºfilter,forward,redirect»úÖÆ×éºÏ£º
ÔÚweb.xmlÅäÖÃÒ»¸öUrlRewriteFilter£¬À¹½ØËùÓнøÀ´µÄÇëÇ󣬶ԷþÎñÒªÇóµÄÇëÇó½øÐÐrewrite¡£±ÈÈ磬¶Ôhttp://www.xxx.net/user/([0-9]+)ÇëÇó£¬forwardµ½/profile.do?id=$1¡£Õâ¾ÍÊÇÒ»Ìõ¹æÔò¡£ÔÚÕâ¸öµÚÈý·½°üÖеĹæÔòÎļþurlrewrite.xmlÖпÉÒÔÕâÑù¶¨Ò壺
Java´úÂë
<rule>   
    <from>^/user/([0-9]+)/?$</from>   
    <to type="forward">/profile.do?id=$1</to>   
</rule>  
<rule>
<from>^/user/([0-9]+)/?$</from>
<to type="forward">/profile.do?id=$1</to>
</rule>
¶ÔÎÒÀ´Ëµ£¬Ò»°ãÎÒ»áÅäÖÃÒ»¸öͨÓõÄrule£¬Ê¹ËùÓÐûÓаüº¬"."µÄurl forwardµ½.doµÄactionÉÏÀ´(±¾ÈËʹÓÃstrut×öϵͳ½Ï¶à)
Java´úÂë
<r


Ïà¹ØÎĵµ£º

Ò»¸öJava³ÌÐòÔ±Ó¦¸ÃÕÆÎÕµÄ10Ïî¼¼ÄÜ


1¡¢Óï·¨£º±ØÐë±È½ÏÊìϤ£¬ÔÚд´úÂëµÄʱºòIDEµÄ±à¼­Æ÷¶ÔijһÐб¨´íÓ¦¸ÃÄܹ»¸ù¾Ý±¨´íÐÅÏ¢ÖªµÀÊÇʲôÑùµÄÓï·¨´íÎó²¢ÇÒÖªµÀÈκÎÐÞÕý¡£
2¡¢ÃüÁ±ØÐëÊìϤJDK´øµÄһЩ³£ÓÃÃüÁî¼°Æä³£ÓÃÑ¡ÏÃüÁîÖÁÉÙÐèÒªÊìϤ£ºappletviewer¡¢ HtmlConverter¡¢jar¡¢ java¡¢javac¡¢javadoc¡¢javap¡¢javaw¡¢native2ascii¡¢serialver£¬Èç¹ûÕâЩÃüÁ ......

×îÖØÒªµÄ Java EE ×î¼Ñʵ¼ù 1. ʼÖÕʹÓà MVC ¿ò¼Ü


 
1. ʼÖÕʹÓà MVC ¿ò¼Ü¡£
½«ÒµÎñÂß¼­£¨Java Bean ºÍ EJB ×é¼þ£©´Ó¿ØÖÆÆ÷Âß¼­£¨Servlet/Struts ²Ù×÷£©ºÍ±íʾÂß¼­£¨JSP¡¢XML/XSLT£©ÖÐÇåÎúµØ·ÖÀë³öÀ´¡£Á¼ºÃµÄ·Ö²ã¿ÉÒÔ´øÀ´Ðí¶àºÃ´¦¡£
×¢:¶ÔÓÚһЩСÐ͵ĻòÕßÒµÎñÏà¶Ô¼òµ¥µÄϵͳ¶øÑÔ,Óÿò¼Ü¿ª·¢²¢²»ÄÜ´øÀ´ÈκÎЧÒæ,²¢ÇÒÎÒÉîÐÅÔÚһЩÏîÄ¿¿ª·¢ÖÐ,ÌرðÊǽö½öÓÉij¸öÈ˶ÀÁ ......

java¹ýÂ˹ؼü×Ö

KeywordFilter.java:
import java.io.InputStream;
import java.util.Enumeration;
import java.util.Properties;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class KeywordFilter
{
private static Pattern pattern = null;
private static KeywordFilter filter = new KeywordF ......

JAVAÖеÄÔËËã·û

£¨
1
£©
+=
:sum += 1;
Ï൱ÓÚ
sum = sum + 1;
£¨
2
£©
++ --
:i++ i
¼Ó
1, i-- i
¼õ
1, ++
»ò

·ÅÔÚÊýÖµºó£¬±íʾִÐÐÔËËãºó¼Ó£¨¼õ£©
1
£¬·´ÕýÊýֵǰ±íʾִÐÐÔËËãÇ°¼Ó£¨¼õ£©
1
£¨
3
£©

: :
int n = a<10?1:2
±íʾÈç¹û
a
СÓÚ
10
Ôò
n
µÈÓÚ
1
·ñÔòµÈÓÚ
2
£¨
4
......

Java Swing JEditorPane

JEditorPaneÌṩÈýÖÖÀàÐ͵ÄÎı¾ÏÔʾ£¬text/plain,text/html,text/rtf.
JEditorPaneµÄ¼òµ¥Ó÷¨DEMOÈçÏ£º
package ibees.swing;
import java.awt.Toolkit;
import java.io.IOException;
import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.event.Hype ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ