Java]JAVA»ñÈ¡Ïà¶Ô·¾¶ÎÊÌâµÄ½â¾ö
(ת£ºhttp://blog.csdn.net/alex197963/archive/2008/03/26/2219994.aspx)
1.»ù±¾¸ÅÄîµÄÀí½â
¡¡¡¡¾ø¶Ô·¾¶:¾ø¶Ô·¾¶¾ÍÊÇÄãµÄÖ÷Ò³ÉϵÄÎļþ»òĿ¼ÔÚÓ²ÅÌÉÏÕæÕýµÄ·¾¶,(URLºÍÎïÀí·¾¶)ÀýÈç:
C:xyz est.txt ´ú±íÁËtest.txtÎļþµÄ¾ø¶Ô·¾¶.http://www.sun.com/index.htmÒ²´ú±íÁËÒ»¸ö
URL¾ø¶Ô·¾¶.
¡¡¡¡Ïà¶Ô·¾¶:Ïà¶ÔÓëij¸ö»ù׼Ŀ¼µÄ·¾¶.°üº¬WebµÄÏà¶Ô·¾¶(HTMLÖеÄÏà¶ÔĿ¼),ÀýÈç:ÔÚ
ServletÖÐ,"/"´ú±íWebÓ¦ÓõĸúĿ¼.ºÍÎïÀí·¾¶µÄÏà¶Ô±íʾ.ÀýÈç:"./" ´ú±íµ±Ç°Ä¿Â¼,
"../"´ú±íÉϼ¶Ä¿Â¼.ÕâÖÖÀàËƵıíʾ,Ò²ÊÇÊôÓÚÏà¶Ô·¾¶.
ÁíÍâ¹ØÓÚURI,URL,URNµÈÄÚÈÝ,Çë²Î¿¼RFCÏà¹ØÎĵµ±ê×¼.
RFC 2396: Uniform Resource Identifiers (URI): Generic Syntax,(http://www.ietf.org/rfc/rfc2396.txt)
2.¹ØÓÚJSP/ServletÖеÄÏà¶Ô·¾¶ºÍ¾ø¶Ô·¾¶.
2.1·þÎñÆ÷¶ËµÄµØÖ·
¡¡¡¡ ·þÎñÆ÷¶ËµÄÏà¶ÔµØÖ·Ö¸µÄÊÇÏà¶ÔÓÚÄãµÄwebÓ¦ÓõĵØÖ·,Õâ¸öµØÖ·ÊÇÔÚ·þÎñÆ÷¶Ë½âÎöµÄ
(²»Í¬ÓÚhtmlºÍjavascriptÖеÄÏà¶ÔµØÖ·,ËûÃÇÊÇÓÉ¿Í»§¶Ëä¯ÀÀÆ÷½âÎöµÄ)Ò²¾ÍÊÇ˵Õâʱºò
ÔÚjspºÍservletÖеÄÏà¶ÔµØÖ·Ó¦¸ÃÊÇÏà¶ÔÓÚÄãµÄwebÓ¦ÓÃ,¼´Ïà¶ÔÓÚhttp://localhost/webapp/µÄ.
ÆäÓõ½µÄµØ·½ÓÐ:
forward:servletÖеÄrequest.getRequestDispatcher(address); Õâ¸öaddressÊÇ
ÔÚ·þÎñÆ÷¶Ë½âÎöµÄ,ËùÒÔ,ÄãÒªforwardµ½a.jspÓ¦¸ÃÕâôд:
request.getRequestDispatcher("/user/a.jsp")Õâ¸ö/Ïà¶ÔÓÚµ±Ç°µÄwebÓ¦ÓÃwebapp,
Æä¾ø¶ÔµØÖ·¾ÍÊÇ:http://localhost/webapp/user/a.jsp.
sendRedirect:ÔÚjspÖм´¿ÉÒÔдhttp://localhost/test.jsp Ò²¿ÉÒÔдÏà¶Ô·¾¶µ«URLÏÔʾ·¢ÉúÌøת
2.22,¿Í»§¶ËµÄµØÖ·
ËùÓеÄhtmlÒ³ÃæÖеÄÏà¶ÔµØÖ·¶¼ÊÇÏà¶ÔÓÚ·þÎñÆ÷¸ùĿ¼(http://localhost/)µÄ,
¶ø²»ÊÇ(¸úĿ¼ÏµĸÃWebÓ¦ÓõÄĿ¼)http://localhost/webapp/µÄ.
HtmlÖеÄform±íµ¥µÄactionÊôÐԵĵØÖ·Ó¦¸ÃÊÇÏà¶ÔÓÚ·þÎñÆ÷¸ùĿ¼(http://localhost/)µÄ,
ËùÒÔ,Èç¹ûÌá½»µ½a.jspΪ:action£½"/webapp/user/a.jsp"»òaction="/user/a.jsp;
¡¡¡¡Ìá½»µ½servletΪactiom£½"/webapp/handleservlet"
¡¡¡¡JavascriptÒ²ÊÇÔÚ¿Í»§¶Ë½âÎöµÄ,ËùÒÔÆäÏà¶Ô·¾¶ºÍform±íµ¥Ò»Ñù.
¡¡¡¡Òò´Ë,Ò»°ãÇé¿öÏÂ,ÔÚJSP/HTMLÒ³ÃæµÈÒýÓõÄCSS,Javascript.ActionµÈÊôÐÔÇ°Ãæ×îºÃ¶¼¼ÓÉÏ
,ÒÔÈ·±£ËùÒýÓõÄÎļþ¶¼ÊôÓÚWebÓ¦ÓÃÖеÄĿ¼.
ÁíÍâ,Ó¦¸Ã¾¡Á¿±ÜÃâʹÓÃÀàËÆ".","./","../../"µÈÀàËƵÄÏà¶Ô¸ÃÎļþλÖõÄÏà¶Ô·¾¶,ÕâÑù
µ±ÎļþÒƶ¯Ê±,ºÜÈÝÒ׳öÎÊÌâ.
3. JSP/ServletÖлñµÃ
Ïà¹ØÎĵµ£º
ÀàÃû£º
java.util.Date
¹¹Ôì·½·¨£º
¹¹Ôì·½·¨ ½â˵
Date()
ÎÞ²ÎÊýµÄ¹¹Ôì·½·¨£¬½«¹¹½¨Ò»¸ö±£³Öµ±Ç°ÈÕÆÚ.ʱ¼äµÄDate¶ÔÏó¡£
Date(long time)
²ÎÊýΪ1970Äê1ÔÂ1ÈÕ00ʱ00·Ö00ÃëÆðËù¾¹ýµÄºÁÃëÊý£¬½«¹¹½¨Ò»¸ö±£³Ö¸ÃÈÕÆÚ.ʱ¼äµÄ¾«È·µ½ºÁÃëµÄDate¶ÔÏó¡£
ÆäËûÓÐЩ¹¹Ôì·½·¨ÒѾ²»ÍƼöʹÓã¬ÕâÀï² ......
JavaÁìÓòµÄ¼´Ê±Í¨ÐŵĽâ¾ö·½°¸¿ÉÒÔ¿¼ÂÇopenfire+spark+smack¡£µ±È»Ò²ÓÐÆäËûµÄÑ¡Ôñ¡£
¡¡¡¡OpenfireÊÇ»ùÓÚJabberÐÒé(XMPP)ʵÏֵļ´Ê±Í¨ÐÅ·þÎñÆ÷¶Ë°æ±¾£¬Ä¿Ç°½¨ÒéʹÓÃ3.6.4°æ±¾£¬Õâ¸ö°æ±¾Êǵ±Ç°×îеİ汾£¬¶øÇÒÍøÉÏ¿ÉÒÔÕÒµ½ÏÂÔصÄÔ´´úÂë¡£
¡¡¡¡¼´Ê±Í¨ÐÅ¿Í»§¶Ë¿ÉʹÓÃspark2.5.8,Õâ¸ö°æ±¾ÊÇÄ¿Ç°×îеÄrelease°æ±¾£¬¾¹ý²âÊÔ· ......
ÔÚûÓкúõØÑÐÏ°ÃæÏò¶ÔÏóÉè¼ÆµÄÉè¼Æģʽ֮ǰ£¬ÎÒ¶ÔJava½Ó¿ÚºÍJava³éÏóÀàµÄÈÏʶ»¹ÊǺÜÄ£ºý£¬ºÜ²»¿ÉÀí½â¡£
¸ÕѧJavaÓïÑÔʱ£¬¾ÍºÜÄÑÀí½âΪʲôҪÓнӿÚÕâ¸ö¸ÅÄËä˵ÊÇ¿ÉÒÔʵÏÖËùνµÄ¶à¼Ì³Ð£¬¿ÉÒ»¸öÖ»Óз½·¨Ãû£¬Ã»Óз½·¨ÌåµÄ¶«Î÷£¬ÎÒʵÏÖËüÓÖÓÐʲôÓÃÄØ£¿ÎÒ´ÓËüÄÇʲôҲµÃ²»µ½£¬³ýÁËһЩ·½·¨Ãû£¬ÎÒÖ±½ÓÔÚ¾ßÌåÀàÀï¼ÓÈëÕâЩ·½ ......
< type="text/javascript">
document.body.oncopy = function() {
if (window.clipboardData) {
setTimeout(function() {
......
DWRÊÇÒ»¸ö¿ò¼Ü£¬¼òµ¥µÄ˵¾ÍÊÇÄܹ»ÔÚjavascriptÖ±½Óµ÷ÓÃjava·½·¨£¬¶ø²»±Øȥдһ´ó¶ÑµÄjavascript´úÂë¡£ËüµÄʵÏÖÊÇ»ùÓÚajaxµÄ£¬¿ÉÒÔʵÏÖÎÞË¢ÐÂЧ¹û¡£
ÍøÉÏÓв»ÉÙDWRµÄÀý×Ó£¬µ«´ó¶¼Ö»ÊÇijÖÖ·½·¨µÄµ÷Ó㬱¾ÎÄÖ»ÔÚʹÓòãÃæÉϽéÉÜDWR£¬²¢²»Éæ¸ü¶àµÄ¼¼ÊõÓëÉè¼Æ£¬ÆäÄ¿µÄÊÇÈóõѧÕßÄܹ»ºÜ¿ìµÄѧ»á¸÷ÖÖjava·½·¨ÔÚjavascriptÖÐÊÇÈçºÎµ ......