锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲www视频,中文在线观看免费,成人高清免费在线播放http://www.aygfsteel.com/paulwong/category/10810.htmlzh-cnWed, 28 Feb 2007 21:11:21 GMTWed, 28 Feb 2007 21:11:21 GMT60- JSP鎶宸х瘒---闃叉嫻忚鍣ㄥ揩鍙栫綉欏?/title>http://www.aygfsteel.com/paulwong/articles/44690.htmlpaulwongpaulwongFri, 05 May 2006 14:54:00 GMThttp://www.aygfsteel.com/paulwong/articles/44690.htmlhttp://www.aygfsteel.com/paulwong/comments/44690.htmlhttp://www.aygfsteel.com/paulwong/articles/44690.html#Feedback0http://www.aygfsteel.com/paulwong/comments/commentRss/44690.htmlhttp://www.aygfsteel.com/paulwong/services/trackbacks/44690.html
嫻?
瑙堝櫒涓轟簡鍔犻熶嬌鐢ㄨ呯殑嫻忚閫熷害錛屽父浼氬皢嫻忚榪囩殑緗戦〉蹇彇鍒扮‖鐩橈紝涓嬫嫻忚鍚屼竴欏墊椂錛屼究鍘葷‖鐩橀噷闈㈠幓鎵撅紝浣嗙幇鍦ㄧ殑緗戦〉甯告槸鍔ㄦ佺殑錛屼負浜嗛伩鍏嶄嬌鐢ㄨ呮姄鍒扮‖鐩樺唴
榪囨湡鐨勬暟鎹紝JSP鍙敤涓嬮潰鐨勬柟寮忔潵闃叉嫻忚鍣ㄥ揩鍙栦綇緗戦〉錛屾鏂規(guī)硶渚垮彲淇濊瘉浣跨敤鑰呭埌榪欎釜緗戦〉鏃跺緇堥兘鍙湅鍒版渶鏂扮殑璧勬枡銆?o:p>
1.JSP璇硶
<%
聽聽聽 聽聽聽 response.setHeader(
"
Pragma
"
,
"
no-cache
"
);
聽聽聽 聽聽聽 response.setHeader(
"
Cache-Control
"
,
"
no-cache
"
);
聽聽聽 聽聽聽 response.setDateHeader(
"
Expires
"
,
0
);
聽聽聽 %>
2.涔熷彲浠ョ敤浠ヤ笅鐨凥TML璇硶錛屽彲鐢ㄥ湪闈欐佺綉欏典笂
<
meta聽http
-
equiv聽
=
聽
"
Pragma
"
聽content
=
"
no-cache
"
>
聽聽聽 <
meta聽http
-
equiv
=
"
Cache-Control
"
聽content
=
"
no-cache
"
>
聽聽聽 <
meta聽http
-
equiv聽
=
聽
"
Expires
"
聽content
=
"
0
"
>
娉ㄦ剰錛岃繖浜汬TML璇硶瑕佷笅鍦?lt;head></head>鐨勬爣絳懼唴銆?/font>

]]> - 濡備綍鍦↗AVA涓嬌鐢ㄦ棩鏈?/title>http://www.aygfsteel.com/paulwong/articles/44682.htmlpaulwongpaulwongFri, 05 May 2006 14:10:00 GMThttp://www.aygfsteel.com/paulwong/articles/44682.htmlhttp://www.aygfsteel.com/paulwong/comments/44682.htmlhttp://www.aygfsteel.com/paulwong/articles/44682.html#Feedback0http://www.aygfsteel.com/paulwong/comments/commentRss/44682.htmlhttp://www.aygfsteel.com/paulwong/services/trackbacks/44682.html濡傛灉鎯寵鍙栧緱緋葷粺鐨勬椂闂達紝鍙互浣跨敤System.currentTimeMillis()鏂規(guī)硶錛屼緥濡傦細
DateDemo.java
1聽public聽class聽DateDemo聽{
2聽聽聽聽聽public聽static聽void聽main(String[]args)聽{
3聽聽聽聽聽聽聽聽 System.out.println(System.currentTimeMillis());
4聽聽聽聽 }
5}
鎵ц緇撴灉浼氭樉紺轟粠1970騫?鏈?鏃?/st1:chsdate>寮濮嬪埌鍙栧緱緋葷粺鏃墮棿涓烘鎵緇忚繃鐨勬縐掓暟錛屼緥濡?115346430703榪欎釜鏁板瓧錛屼絾榪欐牱鐨勬暟瀛楁病鏈変漢紜垏浜嗚В瀹冪殑鎰?涔夋槸浠涔堬紝鎮(zhèn)ㄥ彲浠ヤ嬌鐢―ate綾誨埆鏉ヨ榪欎釜鏁板瓧鍙樼殑鏇存湁鎰忎箟涓浜涳紝渚嬪錛?o:p>
DateDemo.java
import聽java.util.Date;
public聽class聽DateDemo聽{
聽聽聽聽public聽static聽void聽main(String[]args)聽{
聽聽聽聽聽聽聽聽Date聽date聽=聽new聽Date();聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
聽聽聽聽聽聽聽 System.out.println(date.toString());
聽聽聽聽聽聽聽聽System.out.println(date.getTime());
聽聽聽聽}
}
鎵ц鐨勭粨鏋滃涓嬶細
聽 Fri May 06 10:31:13 GMT+08:00 2005
聽聽1115346673531
褰撴?zhèn)ㄧ敓鎴怐ate瀵硅薄鏃訛紝瀹為檯涓婂畠浼氫嬌鐢⊿ystem.currentTimeMillis()鏉ュ彇寰楃郴緇熸椂闂達紝鑰屾?zhèn)ㄤ娇鐢?br />toString()鏂規(guī)硶鏃訛紝浼氬皢鍙栧緱鐨?st1:chsdate year="1970" month="1" day="1" islunardate="False" isrocdate="False" w:st="on">1970騫?鏈?鏃?/st1:chsdate>鑷充粖鐨勬縐掓暟杞負dow mon dd hh:mm:ss zzz yyyy鐨勬牸寮忥紝鍒嗗埆鏄細銆屾槦鏈?鏈?鏃?鏃訛細鍒嗭細縐?鍏厓銆嶏紱浣跨敤Date鐨?b>getTime()鏂規(guī)硶鍒欏彲浠ュ彇寰楁縐掓暟銆?br />
濡傛灉鎮(zhèn)ㄦ兂瑕佸鏃ユ湡鏃墮棿浣滄牸寮忚瀹氾紝鍒欏彲浠ヤ嬌鐢―ateFormat鏉ヤ綔鏍煎紡鍖栵紝鍏堟潵鐪嬬湅瀹冪殑瀛愮被SimpleDateFormat濡備綍浣跨敤錛?o:p>
DateDemo.java
聽聽聽
import聽java.text.DateFormat;
import聽java.text.SimpleDateFormat;
import聽java.util.Date;
public聽class聽DateDemo聽{
聽聽聽聽public聽static聽void聽main(String[]args)聽{
聽聽聽聽聽聽聽聽Date聽date聽=聽new聽Date();
聽聽聽聽聽聽聽聽DateFormat聽dateFormat聽=聽new聽聽SimpleDateFormat("EE-MM-dd-yyyy");
聽聽聽聽聽聽聽 System.out.println(dateFormat.format(date));
聽聽聽聽}
}
鎵ц緇撴灉錛?o:p>
聽聽
聽聽鏄熸湡浜?05-06-2005
DateFormat浼氫緷璁$畻鏈轟笂鐨勫尯鍩熻瀹氭樉紺烘椂闂存牸寮忥紝EE琛ㄧず鏄熸湡錛孧M琛ㄧず鏈堜喚銆乨d琛ㄧず鏃ユ湡錛岃寉yyy鏄叕鍏冿紝姣忎釜瀛楃鐨勮瀹氶兘鍚勬湁鍏舵剰涔夛紝鎮(zhèn)?br />鍙互鍙傝?SimpleDateFormat
鐨凙PI璇存槑浜嗚В姣忎釜瀛楃璁懼畾鐨勬剰涔夈?br />
鎮(zhèn)ㄤ篃鍙互鐩存帴浠嶥ateFormat鎸囧畾鏍煎紡鐢熸垚DateFormat鐨勫疄渚嬶紝渚嬪錛?o:p>
DateDemo.java
聽聽聽
import聽java.text.DateFormat;
import聽java.util.Date;
public聽class聽DateDemo聽{
聽聽聽聽public聽static聽void聽main(String[]聽args)聽{
聽聽聽聽聽聽聽聽Date聽date聽=聽new聽Date();
聽聽聽 聽聽聽 DateFormat聽shortFormat聽=聽聽DateFormat.getDateTimeInstance(DateFormat.SHORT,
DateFormat.SHORT);
聽聽聽聽聽聽聽 DateFormat聽mediumFormat聽= DateFormat.getDateTimeInstance(DateFormat.MEDIUM,DateFormat.MEDIUM);
聽聽聽 聽聽聽 DateFormat聽longFormat聽= DateFormat.getDateTimeInstance(DateFormat.LONG,聽DateFormat.LONG);
聽聽聽聽聽聽聽 DateFormat聽fullFormat聽= DateFormat.getDateTimeInstance(DateFormat.FULL,DateFormat.FULL);
聽聽聽聽聽聽聽 System.out.println(shortFormat.format(date));
聽聽聽聽聽聽聽聽System.out.println(mediumFormat.format(date));
聽聽聽聽聽聽聽聽System.out.println(longFormat.format(date));
聽聽聽聽聽聽聽聽System.out.println(fullFormat.format(date));
聽聽聽聽}
}
鍦ㄤ嬌鐢?b>getDateTimeInstance()鍙栧緱DateFormat瀹炰緥鏃訛紝鍙互鎸囧畾鐨勫弬鏁版槸鏃ユ湡鏍煎紡涓庢椂闂存牸寮忥紝浠ヤ笂鎵鎸囧畾鐨勬牸寮忎緷璁伅璇︾粏搴?鍖哄垎錛屾墽琛岀粨鏋滃涓嬶細
聽聽 2005/5/6 涓婂崍 10:45 2005/5/6 涓婂崍 10:45:25 2005騫?鏈?鏃?/st1:chsdate> 涓婂崍10鏃?5鍒?5縐?br />2005騫?鏈?鏃?/st1:chsdate> 鏄熸湡浜?涓婂崍10鏃?5鍒?5縐?GMT+08:00
聽聽 |
鎮(zhèn)ㄤ篃鍙互浣跨敤getDateInstance()鍙栧緱DateFormat瀹?渚嬶紝騫跺悓鏃舵寚瀹氭棩鏈熺殑鍖哄煙鏄劇ず鏂瑰紡錛屼緥濡傦細
DateDemo.java
import聽java.text.DateFormat;
import聽java.util.Date;
import聽java.util.Locale;
public聽class聽DateDemo聽{
聽聽聽聽public聽static聽void聽main(String[]聽args)聽{
聽聽聽聽聽聽聽聽Date聽date聽=聽new聽Date();
聽聽聽聽聽聽聽聽Locale聽locale聽=聽new聽Locale("en",聽"US");
聽聽聽聽聽聽聽聽DateFormat聽shortFormat聽=聽 DateFormat.getDateInstance(DateFormat.SHORT,locale);
聽聽聽聽聽聽聽聽DateFormat聽mediumFormat聽=聽DateFormat.getDateInstance(聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽DateFormat.MEDIUM,locale);
聽聽聽聽聽聽聽聽DateFormat聽longFormat聽= DateFormat.getDateInstance(DateFormat.LONG,聽locale);
聽聽聽聽聽聽聽聽DateFormat聽fullFormat聽= DateFormat.getDateInstance(DateFormat.FULL,聽locale);
聽聽聽 聽聽聽 System.out.println(shortFormat.format(date));
聽聽聽 聽聽聽 System.out.println(mediumFormat.format(date));
聽聽聽 聽聽聽 System.out.println(longFormat.format(date));
聽聽聽 聽聽聽 System.out.println(fullFormat.format(date));
聽聽聽聽}
}
榪欒竟鎸囧畾浜嗙編鍥界殑鏃墮棿鏄劇ず鏂瑰紡錛屾墽琛岀粨鏋滃涓嬶細
聽 5/6/05
聽聽May 6, 2005
聽聽May 6, 2005
聽聽Friday, May 6, 2005
聽聽聽

]]>- 鍦═omcat涓嬌鐢ㄨ繛鎺ユ睜http://www.aygfsteel.com/paulwong/articles/44677.htmlpaulwongpaulwongFri, 05 May 2006 13:49:00 GMThttp://www.aygfsteel.com/paulwong/articles/44677.htmlhttp://www.aygfsteel.com/paulwong/comments/44677.htmlhttp://www.aygfsteel.com/paulwong/articles/44677.html#Feedback0http://www.aygfsteel.com/paulwong/comments/commentRss/44677.htmlhttp://www.aygfsteel.com/paulwong/services/trackbacks/44677.html
1.閰嶇疆server.xml
<Resource聽name="jdbc/myoracle"聽auth="Container"
聽聽聽聽聽聽聽聽聽聽聽聽聽聽type="javax.sql.DataSource"/>聽
<ResourceParams聽name="jdbc/myoracle">
聽聽<parameter>
聽聽聽聽<name>factory</name>
聽聽聽聽<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
聽聽</parameter>
聽聽<parameter>
聽聽聽聽<name>driverClassName</name>
聽聽聽聽<value>oracle.jdbc.driver.OracleDriver</value>
聽聽</parameter>
聽聽<parameter>
聽聽聽聽<name>url</name>
聽聽聽聽<value>jdbc:oracle:thin:myschema@127.0.0.1:1521:mysid</value>
聽聽</parameter>
聽聽<parameter>
聽聽聽聽<name>username</name>
聽聽聽聽<value>scott</value>
聽聽</parameter>
聽聽<parameter>
聽聽聽聽<name>password</name>
聽聽聽聽<value>tiger</value>
聽聽</parameter>
聽聽<parameter>
聽聽聽聽<name>maxActive</name>
聽聽聽聽<value>20</value>
聽聽</parameter>
聽聽<parameter>
聽聽聽聽<name>maxIdle</name>
聽聽聽聽<value>10</value>
聽聽</parameter>
聽聽<parameter>
聽聽聽聽<name>maxWait</name>
聽聽聽聽<value>-1</value>
聽聽</parameter>
</ResourceParams>
2.閰嶇疆web.xml
鍦?lt;/web-app>鑺傜偣涓嬪姞涓嬮潰淇℃伅錛?br />
<resource-ref>
聽<description>Oracle聽Datasource聽example</description>
聽<res-ref-name>jdbc/myoracle</res-ref-name>
聽<res-type>javax.sql.DataSource</res-type>
聽<res-auth>Container</res-auth>
</resource-ref>
3.嫻嬭瘯鐨勪唬鐮?/h3>
Context聽initContext聽=聽new聽InitialContext();
Context聽envContext聽聽=聽(Context)initContext.lookup("java:/comp/env");
DataSource聽ds聽=聽(DataSource)envContext.lookup("jdbc/myoracle");
Connection聽conn聽=聽ds.getConnection();
//etc.

]]>
主站蜘蛛池模板:
改则县|
仁怀市|
泾川县|
永寿县|
唐海县|
库尔勒市|
博客|
彭泽县|
余干县|
乌兰察布市|
平舆县|
扬中市|
寿阳县|
将乐县|
临武县|
柳州市|
宁陕县|
通渭县|
南宫市|
灵石县|
鲜城|
南城县|
厦门市|
牙克石市|
达拉特旗|
榆林市|
常山县|
运城市|
惠水县|
双桥区|
永州市|
鹿泉市|
墨玉县|
冕宁县|
英德市|
四平市|
和平区|
休宁县|
科技|
花莲市|
称多县|