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

ÔÚ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()%>,ÒÔÈ·±£ËùÒý


Ïà¹ØÎĵµ£º

java½Ó¿ÚºÍ³éÏóÀà

Ê×ÏÈjava½Ó¿ÚºÍ³éÏóÀà´ú±íµÄ¾ÍÊdzéÏóÀàÐÍ£¬¾ÍÊÇÎÒÃÇÐèÒªÌá³ö³éÏó²ãµÄ¾ßÌåʵÏÖ£¬Èç¹ûÒªÌá¸ß³ÌÐòµÄ¸´ÓÃÂÊ£¬¿Éά»¤ÐÔ£¬¿ÉÀ©Õ¹ÐÔ£¬¾Í±ØÐëÃæÏò½Ó¿ÚºÍ³éÏó±à³Ì£¬ÕýȷʹÓÃËûÃÇ¡£ £¨1£©³éÏóÀà¿ÉÒÔÌṩʵÏÖ·½·¨£¬½Ó¿Ú²»ÄÜ
ÕâÊdzéÏóÀàµÄΨһÓŵ㣬¶øÇҷdz£ÓÐÓã¬ÀýÈ磬Ä㶨ÒåÒ»¸ö½Ó¿Ú£¬×ÓÀ಻ÐèÒªËûµÄËùÓз½·¨£¬¿ÉÊÇÄãû°ì·¨²»È¥ ......

java ·¢ËÍÓʼþʵÀý

package com.sj.main;
public class Snippet {
public static void main(String[] args){
//Õâ¸öÀàÖ÷ÒªÊÇÉèÖÃÓʼþ
MailSenderInfo mailInfo = new MailSenderInfo();
String biaoti ="ÎÒÊÇËÕ½¨£¬ÕâÊÇÎҵIJâÊÔÓʼþ";
String neirong = "ÎÒÊÇËÕ½¨ÒÔÏÂÊÇÎҵIJâÊÔÓʼþ£¬»¶Ó­´ó¼Ò½ ......

Java synchronized

ÖÚËùÖÜÖª£¬ÔÚJava¶àÏ̱߳à³ÌÖУ¬Ò»¸ö·Ç³£ÖØÒªµÄ·½Ãæ¾ÍÊÇÏ̵߳Äͬ²½ÎÊÌâ¡£
¹ØÓÚÏ̵߳Äͬ²½£¬Ò»°ãÓÐÒÔϽâ¾ö·½·¨£º

1.
ÔÚÐèҪͬ²½µÄ·½·¨µÄ·½·¨Ç©ÃûÖмÓÈësynchronized¹Ø¼ü×Ö¡£

2.
ʹÓÃsynchronized¿é¶ÔÐèÒª½øÐÐͬ²½µÄ´úÂë¶Î½øÐÐͬ²½¡£

3. ʹÓÃJDK
5ÖÐÌṩµÄjava.util.concurrent.lock°üÖеÄLock¶ÔÏó¡£ ......

Java Semaphore

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 ......

javaÃæÊÔÌâ¼°´ð°¸£¨»ù´¡Ìâ122µÀ£¬´úÂëÌâ19µÀ£©

JAVAÏà¹Ø»ù´¡ÖªÊ¶
1¡¢ÃæÏò¶ÔÏóµÄÌØÕ÷ÓÐÄÄЩ·½Ãæ
1.³éÏó£º
³éÏó¾ÍÊǺöÂÔÒ»¸öÖ÷ÌâÖÐÓ뵱ǰĿ±êÎ޹صÄÄÇЩ·½Ã棬ÒÔ±ã¸ü³ä·ÖµØ×¢ÒâÓ뵱ǰĿ±êÓйصķ½Ãæ¡£³éÏó²¢²»´òËãÁ˽âÈ«²¿ÎÊÌ⣬¶øÖ»ÊÇÑ¡ÔñÆäÖеÄÒ»²¿·Ö£¬ÔÝʱ²»Óò¿·Öϸ½Ú¡£³éÏó°üÀ¨Á½¸ö·½Ã棬һÊǹý³Ì³éÏ󣬶þÊÇÊý¾Ý³éÏó¡£
2.¼Ì³Ð£º
¼Ì³ÐÊÇÒ»ÖÖÁª½áÀàµÄ²ã´ÎÄ£ÐÍ£¬²¢ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ