ÔÚJAVAÎļþÖлñÈ¡¸ÃÏîÄ¿µÄÏà¶Ô·¾¶
ÔÚJAVAÎļþÖлñÈ¡¸ÃÏîÄ¿µÄÏà¶Ô·¾¶
1.»ù±¾¸ÅÄîµÄÀí½â
¡¡¡¡¾ø¶Ô·¾¶£º¾ø¶Ô·¾¶¾ÍÊÇÄãµÄÖ÷Ò³ÉϵÄÎļþ»òĿ¼ÔÚÓ²ÅÌÉÏÕæÕýµÄ·¾¶£¬(URLºÍÎïÀí·¾¶)ÀýÈ磺
C:\xyz\test.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://192.168.0.1/webapp/µÄ¡£
¡¡¡¡ÆäÓõ½µÄµØ·½ÓУº
forward£ºservletÖеÄrequest.getRequestDispatcher(address);Õâ¸öaddressÊÇ
ÔÚ·þÎñÆ÷¶Ë½âÎöµÄ£¬ËùÒÔ£¬ÄãÒªforwardµ½a.jspÓ¦¸ÃÕâôд£º
request.getRequestDispatcher(“/user/a.jsp”)Õâ¸ö/Ïà¶ÔÓÚµ±Ç°µÄwebÓ¦ÓÃwebapp£¬
Æä¾ø¶ÔµØÖ·¾ÍÊÇ£ºhttp://192.168.0.1/webapp/user/a.jsp¡£
sendRedirect£ºÔÚjspÖÐ<%response.sendRedirect("/rtccp/user/a.jsp");%>
2.22¡¢¿Í»§¶ËµÄµØÖ·
ËùÓеÄhtmlÒ³ÃæÖеÄÏà¶ÔµØÖ·¶¼ÊÇÏà¶ÔÓÚ·þÎñÆ÷¸ùĿ¼(http://192.168.0.1/)µÄ£¬
¶ø²»ÊÇ(¸úĿ¼ÏµĸÃWebÓ¦ÓõÄĿ¼)http://192.168.0.1/webapp/µÄ¡£
HtmlÖеÄform±íµ¥µÄactionÊôÐԵĵØÖ·Ó¦¸ÃÊÇÏà¶ÔÓÚ·þÎñÆ÷¸ùĿ¼(http://192.168.0.1/)µÄ£¬
ËùÒÔ£¬Èç¹ûÌá½»µ½a.jspΪ£ºaction£½"/webapp/user/a.jsp"»òaction="<%=request.getContextPath()%>"/user/a.jsp£»
¡¡¡¡Ìá½»µ½servletΪactiom£½"/webapp/handleservlet"
¡¡¡¡JavascriptÒ²ÊÇÔÚ¿Í»§¶Ë½âÎöµÄ£¬ËùÒÔÆäÏà¶Ô·¾¶ºÍform±íµ¥Ò»Ñù¡£
¡¡¡¡Òò´Ë£¬Ò»°ãÇé¿öÏ£¬ÔÚJSP/HTMLÒ³ÃæµÈÒýÓõÄCSS,Javascript.ActionµÈÊôÐÔÇ°Ãæ×îºÃ¶¼¼ÓÉÏ
<%=request.getContextPath()%>,ÒÔÈ·±£ËùÒý
Ïà¹ØÎĵµ£º
http://developers.sun.com/javadb/
Java SE 6 ÐÂÌØÐÔ: Java DB ºÍ JDBC 4.0
http://www.ibm.com/developerworks/cn/java/j-lo-jse65/
³¤¾ÃÒÔÀ´£¬ÓÉÓÚ´óÁ¿£¨ÉõÖÁ¼¸ºõËùÓУ©µÄ Java Ó¦Óö¼ÒÀÀµÓÚÊý¾Ý¿â£¬ÈçºÎʹÓà Java ÓïÑÔ¸ßЧ¡¢¿É¿¿¡¢¼ò½àµØ·ÃÎÊÊý¾Ý¿âÒ»Ö±ÊdzÌÐòÔ±Ãǽò½òÀÖµÀµÄ»°Ì⡣з¢²¼µÄ Java SE 6 Ò²ÔÚÕâ·½Ãæ¸üÉ ......
JavaµÄ¿çƽ̨ÊÇͨ¹ýJavaÐéÄâ»ú£¨JVM£©À´ÊµÏֵġ£
JavaÔ´ÎļþµÄ±àÒë¹ý³Ì
JavaÓ¦ÓóÌÐòµÄ¿ª·¢ÖÜÆÚ°üÀ¨±àÒë¡¢ÏÂÔØ¡¢½âÊͺÍÖ´Ðм¸¸ö²¿·Ö¡£Java±àÒë³ÌÐò½«JavaÔ´³ÌÐò·ÒëΪJVM¿ÉÖ´ÐдúÂë—×Ö½ÚÂë¡£ÕâÒ»±àÒë¹ý ......
Date ---->String
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String date = sdf.fomat(new Date());
String ---->Date
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date date = sdf.parse("2010-03-16");
ÈÕÆڱȽϴóС£¬Õâ¾ÍÓõ½ÁËDateÀàÖеÄbefore()ºÍafter()·½· ......
package test;
/**
*
* @author openpk
*/
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Semaphore;
public class Main {
public static void main(String[] args) {
// Ï̳߳Ø
ExecutorService exec = Executors ......
¼ò¶øÑÔÖ®£¬ÕâÁ½¸öÀàÊÇÓÃÀ´ÀûÓÃÕýÔò±í´ïʽÑéÖ¤×Ö·û´®ÓÐЧÐԵġ£
PatternÀàÓÃÀ´¶¨ÒåÕýÔò±í´ïʽ¹æÔò£¬MatcherÀàÓÃÀ´¶¨ÒåÒªÑéÖ¤µÄ×Ö·û´®¡£
Ó÷¨£º
Pattern p = Pattern.compile("a*b");
Matcher m = p.matcher("aaaaab");
boolean b = m.matches();
µ±È»£¬Ò²¿ÉÒÔÖ±½ÓÓÃPatternÀàÖ±½ÓÑéÖ¤£¬Ó÷¨£º
boolean ......