java synchronized - Java / Java SE
Java code:
......
synchronized(user){
int loginNum = Integer.parseInt(Main_Client_Dia.jtf2.getText().trim());
Main_Client_Dia.jtf2.setText("");
loginNum++;
Main_Client_Dia.jtf2.setText(loginNum+"");
}
......
¼¸°Ù¸öÏß³Ìͬʱ·ÃÎÊÉÏÃæµÄ´úÂë
Ϊʲô ÎÞ·¨ ʵÏÖͬ²½ÄØ
Main_Client_Dia.jtf2.setTextµÄֵʱÓÐʱ»á²»ÊÇÏëÒªµÄ½á¹û£¬
ûÌåÑé¹ýÉϰٸöÏ̷߳ÃÎÊ£¡£¡
ÎÒ¾õµÃÓ¦¸ÃÊǶÔÏóuser²»ÄÜʵÏÖ£¡£¡
Äã°ÑÀ¨ºÅºÍÀïÃæµÄuserÈ¥µôÊÔÊÔ
Ê×ÏÈÄãҪȷ¶¨Äãÿһ¸öÏß³ÌÖеÄuserÊÇͬһ¸ö¶ÔÏó.Èç¹û²»ÊÇͬһ¸ö¶ÔÏóÒ²¾ÍûÓÐÒâÒåÁË!
¶¥
ÿ¸öuser¶ÔÏóÊÇͨ¹ý¹¹Ô캯Êý´«½øÀ´µÄ£¬Ã¿¸öÏ̵߳Äuser¶ÔÏóÊDz»Í¬µÄ
¶øÇÒ£¬ int loginNum = Integer.parseInt(Main_Client_Dia.jtf2.getText().trim());
¾³£³ö´í£¬Ìáʾ˵Main_Client_Dia.jtf2.getText().trim()µÃµ½µÄֵΪ"";
Ïà¹ØÎÊ´ð£º
Ò»¸öJSPÒ³Ãæ½ÓÊÕÆäËûÒ³ÃæÌá½»¹ýÀ´µÄFORM±íµ¥£¬µ«ÊÇÒªÇóÖ»½ÓÊÕµ±Ç°Õ¾µã¼°Æä×ÓÕ¾µãÌá½»¹ýÀ´µÄFORM±íµ¥£¬ÆäËûÕ¾µãÌá½»¹ýÀ´µÄ±íµ¥²»½ÓÊÕ£¬Õâ¸öÔõôÉèÖã¿
ÓùýÂËÆ÷
filter
½«µ±Ç°Õ¾µã¼°Æä×ÓÕ¾µã·ÅÒ»¸öĿ¼
È» ......
ΪʲôHTMLÒÔ¼°Ò»Ð©ÆäËü±êÇ©»áÏÔÊ¾Ò»Ð©ÌØ¶¨±íÏÖÐÎÊ½ÄØ£¿ÈçHTMLÖеĻ»ÐбêÇ©<BR/>ÔڵײãÊÇÔõÑùʵÏÖµÄÄØ£¿ÏÖʵµÄÔÀíÊÇÊ²Ã´ÄØ
È¥W3C¹Ù·½ÍøÕ¾ÉÏ£¬¿´¿´°É£¡ÎÒÏëÒ»¿´Äã¾ÍÃ÷°×ÁË
ÎҲºͱàÒëÔÀíÓйأ¬ä¯ÀÀÆ÷Àï¿É ......
³ÌÐòÈçÏÂ:
<%@ page contentType="text/html; charset=GBK" %>
<%@ page language="java" %>
<%@ page import="com.mysql.jdbc.Driver" %>
<%@ page import ......
´ó¼ÒºÃ£¬ÎÒÏÖÔÚÓÐÒ»¸öÓÃaspдµÄÁÄÌìÊÒ£¬ÏÖÔÚµÄÏëÌí¼ÓÒ»¸ö¹¦ÄÜ£¬¾ÍÊǵ±ÓÐÈËÉÏÏßµÄʱºò£¬·¢³öÌáʾ£¬±ÈÈçÉùÒôÏìһϣ¬ÏÖÔÚÏëÓÃjavaʵÏÖÕâ¸ö¹¦ÄÜ£¬ÇëÎÊ´ó¼ÒÔõôʵÏÖ£¿
ллÁË£¬ÎÒ»á¼Ó·ÖµÄ
aspºÍjavaÕûºÏµ½Ò»ÆðÈ¥£¿ºÎ±Ø ......
¾ÍÊǼòµ¥µÄ´«ÖµºÍȡֵ
ÇëÎÊÂ¥Ö÷ÏëÎÊʲô£¿
jspÒ³Ãæ²ÉÓÃ±íµ¥»òÕßjavabean´«Öµ¶¼¿ÉÒÔ£¬Ê¹ÓÃrequest.getParameter()»ñµÃʹÓÃ±íµ¥´«¹ýÀ´µÄÖµ¡£
ÎÊÎÊÌ⣬ÏȰÑÎÊÌâ˵Çå³þµã£¡£¡ ÎÊÌâ̫ģºý£¡£¡
ÎÊÎÊÌ⣬ÏȰÑÎ ......