锘??xml version="1.0" encoding="utf-8" standalone="yes"?> Any existing applications that use the Cancel processing will need to modify their struts-config.xml to set the cancellable property for actions which require it. In Struts 1.2.9 the <set-property> is used to set the cancellable property for an action.... From Struts 1.3.x a new cancellable attribute can be used.... In both Struts 1.2.9 and Struts 1.3.x an exception handler can be configured to handle the InvalidCancelException ---------------------------------------end-----------------------------------------------------
]]>
java 1.4鏃ュ織綰綍鍦?/span>java.util.logging.Level綾諱腑瀹氫箟浜嗕笅鍒楁棩蹇楃駭鍒父鏁?/span>
Ø SERVER錛?/span>琛ㄧず涓涓弗閲嶅け璐ャ傚父甯稿皢鏈変竴涓即闅忕殑Throwable銆?/span>
Ø CONFIG錛?/span>涓哄簲鐢ㄩ厤緗湡闂存墍鐢熸垚鐨勬秷鎭岃璁$殑銆?/span>
Ø INFO錛?/span>涓瓑浼樺厛綰с傝〃紺轟竴涓瀯浠舵鍦ㄥ仛浠涔堬紙渚嬪錛岀洃瑙嗕竴欏逛換鍔$殑 榪愯榪涘害錛夛紝浣嗕笉鏄敤鏉ュ府鍔╄皟璇曡鏋勪歡銆?/span>
Ø FINE錛?/span>璺熻釜淇℃伅銆傝綰у埆鍜岃緝浣庝紭鍏堢駭鐨勭駭鍒簲璇ョ敤鏉ュ府鍔╄皟璇曟煇浜涚被錛屼絾涓嶅簲璇ョ敤鏉ユ諱綋鐨勮鏄庤搴旂敤鐨勫伐浣滄柟寮忋?/span>
Ø FINER錛?/span>璇︾粏鐨勮窡韙俊鎭?/span>
Ø FINEST錛?/span>闈炲父璇︾粏鐨勮窡韙俊鎭?/span>
Log4j鍦?/span>
綾諱腑瀹氫箟浜嗕笅鍒楁棩蹇楃駭鍒父鏁?/span>
Ø FATAL錛?/span>琛ㄧず涓涓弗閲嶅け璐ャ傚鑷?/span>application鐨勪腑鏂?/span>
Ø ERROR錛?/span>琛ㄧず涓涓敊璇簨浠躲傚彲浠ュ厑璁?/span>Application鍙互緇х畫榪愯銆?/span>
Ø WARN錛?/span>琛ㄧず涓涓湁娼滃湪鐨勫嵄闄┿?/span>
Ø INFO錛?/span>琛ㄧず涓涓瀯浠舵鍦ㄥ仛閲嶈榪愯鎯呭喌錛屼俊鎭瘮杈冪矖緋欍?/span>
Ø DEBUG錛?/span>琛ㄧず涓涓瀯浠惰緇嗙殑榪愯鎯呭喌錛岀敤浜庤皟璇?/span>Application銆?/span>
Ø ALL錛?/span>琛ㄧず綰綍鎵鏈夌駭鍒殑鏃ュ織淇℃伅銆?/span>
Common-logging鐨勬棩蹇楃駭鍒垎涓?/span>6縐嶏紝浠庝綆鍒伴珮鍒嗗埆涓?/span>trace錛?/span>debug錛?/span>info錛?/span>warn錛?/span>error錛?/span>fatal銆?/span>
Ø FATAL錛?/span>琛ㄧず涓涓弗閲嶅け璐ャ傚鑷?/span>application鐨勪腑鏂?/span>
Ø ERROR錛?/span>琛ㄧず涓涓敊璇簨浠躲傚彲浠ュ厑璁?/span>Application鍙互緇х畫榪愯銆?/span>
Ø WARN錛?/span>琛ㄧず涓涓湁娼滃湪鐨勫嵄闄┿?/span>
Ø INFO錛?/span>琛ㄧず涓涓瀯浠舵鍦ㄥ仛閲嶈榪愯鎯呭喌錛屼俊鎭瘮杈冪矖緋欍?/span>
Ø DEBUG錛?/span>琛ㄧず涓涓瀯浠惰緇嗙殑榪愯鎯呭喌錛岀敤浜庤皟璇?/span>Application銆?/span>
Ø TRACE錛?/span>闈炲父璇︾粏鐨勮窡韙俊鎭紝浠呬粎鐢ㄤ簬綰綍璇ユ棩蹇楄屽凡銆?br />
]]>
response.addHeader("Content-Disposition","attachment;filename="+filename);
]]>
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
* 閲嶅鎺ユ敹鐢ㄦ埛杈撳叆涓琛屽懡浠?br />
* @author chenlb 2008-3-11 涓嬪崍09:24:50
*/
public class UserInput {
public static void main(String[] args) throws IOException {
System.out.println("璇存槑: 杈撳叆QUIT閫鍑?/span>");
System.out.print("\ninput>");
String inputStr = null;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
while((inputStr = br.readLine()) != null) {
if(inputStr.equals("QUIT")) {
System.exit(0);
}
System.out.println("浣犺緭鍏ョ殑鏄? "+inputStr); //澶勭悊浣犵殑閫昏緫
System.out.print("\ninput>");
}
}
}
]]>
浠g爜鐗囨柇錛?br />
DefaultStyledDocument styledDoc = new DefaultStyledDocument(); //javax.swing.text.Document鐨勪竴涓疄渚?/span>
try {
InputStream is = new FileInputStream(new File("data/java.swing.text璇籖TF鏂囨。嫻嬭瘯.rtf"));
new RTFEditorKit().read(is, styledDoc, 0);
bodyText = new String(styledDoc.getText(0, styledDoc.getLength()).getBytes("ISO8859_1")); //鎻愬彇鏂囨湰
} catch (IOException e) {
throw new DocumentHandlerException("涓嶈兘浠嶳TF涓憳褰曟枃鏈?", e);
} catch (BadLocationException e) {
throw new DocumentHandlerException("涓嶈兘浠嶳TF涓憳褰曟枃鏈?", e);
}
System.out.println(bodyText);
]]>
絎旇瘯鐨勯鐩被浼煎湴錛氫竴涓敓浜ц呬竴嬈$敓浜?0涓紝婊′簡鍚庨氱煡娑堣垂鑰咃紝鐒跺悗絳夊緟銆備竴涓秷璐硅呬駭鍝佹湁婊′簡灝辨秷璐廣傚埌絀烘椂閫氱煡鐢熶駭鑰咃紝鐒跺悗絳夊緟銆?br />
閭f椂瀵圭瓑寰?閫氱煡鏈哄埗娌℃庝箞鍐欒繃錛岄偅嬈$瑪璇曞簲璇ュ啓鐨勫ぇ姒傚錛堟兂娉曞錛夛紝浣嗗啓鐨剋ait()鍜宯otifyAll()鐨勪綅緗笉瀵廣傜幇鍦ㄦ湁鏃墮棿灝卞啓浜嗚繖涓緥瀛愩?br />
鎻忚堪錛氱敓浜ц呬竴嬈$敓浜涓駭鍝侊紝姹犱腑杈懼埌M灝辯瓑寰咃紝閫氱煡絳夊緟鐨勬秷璐硅呫傛秷璐硅呮湁浜у搧灝辨秷璐癸紝鍒版病鏈夋椂灝遍氱煡鐢熶駭鑰咃紝鐒跺悗絳夊緟銆?br />
1.鐢熶駭鑰咃細
import java.util.List;
/**
* @author chenlb
*
* 鐢熶駭鑰?<br/>
* 榛樿浜у搧姹犲ぇ灝廙=20,浜у搧姊樁澶у皬N=5.鍦ㄧ敓浜ц繃紼嬩腑,姹犵殑澶у皬浼氳秴榪?0,浣嗘睜涓渶澶у簲璇ユ槸M+N-1.
*/
public class Producer implements Runnable {
/**
* 姹犻粯璁ゅぇ灝?br />
*/
public static final int DEFALUT_SIZE = 20;
/**
* 榛樿涓嬈$敓浜х殑鏁伴噺
*/
public static final int DEFALUT_STEP_SIZE = 5;
private static int PRODUCER_ID = 0; //鐢熶駭鑰呭彿
private List<Product> pool = null;
private int size = DEFALUT_SIZE;
private int stepSize = DEFALUT_STEP_SIZE;
private String name = "Producer_"+(++PRODUCER_ID); //鐢熶駭鑰呭悕
private boolean isRun = true;
/**
* 榛樿浜у搧姹犲ぇ灝?0, 榛樿浜у搧澧為暱姊樁澶у皬5
*/
public Producer(List<Product> pool) {
this.pool = pool;
}
/**
* @param pool
* @param size 姹犲ぇ灝?br />
*/
public Producer(List<Product> pool, int size) {
this.pool = pool;
this.size = size;
}
/**
* @param pool
* @param size 姹犲ぇ灝?br />
* @param stepSize 涓嬈$敓浜у灝?br />
*/
public Producer(List<Product> pool, int size, int stepSize) {
this.pool = pool;
this.size = size;
this.stepSize = stepSize;
}
public void run() {
// TODO 鐢熶駭鑰呯嚎紼?br />
//int pi = 0;
while(isRun) {//&& pi<10
//pi++;
synchronized (pool) { //鍚屾浜у搧姹?/span>
if(pool.size() >= size) {
try {
System.out.println(name+" 絳夊緟!");
pool.wait(); //鍚屾浠涔堝氨絳夊緟浠涔?鍚﹀垯鎶涘嚭java.lang.IllegalMonitorStateException
} catch (InterruptedException e) {
isRun = false;
System.out.println(name+" thread interrupt!");
}
} else {
for(int i=0; i<stepSize; i++) { //涓嬈$敓浜tepSize涓駭鍝?/span>
pool.add(product()); //鐢熶駭浜у搧
}
System.out.println("浜у搧姹犱腑鏈? "+pool.size());
pool.notifyAll(); //閫氱煡絳夊緟鐨勭嚎紼?涓昏鐢ㄦ潵閫氱煡娑堣垂鑰? 浣嗙敓浜ц呯嚎紼嬩篃浼氶氱煡鍒?
}
}
try {
System.out.println(name+" 浼戞伅1縐?");
Thread.sleep(1000); //璋冭瘯鐢?/span>
} catch (InterruptedException e) {
System.out.println(name+" sleep 1s thread interrupt");
}
}
System.out.println(name+" end! pool size: "+pool.size());
}
private static int P_ID = 0;
/**
* 鐢熶駭浜у搧
* @return 浜у搧
*/
private Product product() {
String name = "product_"+(++P_ID);
System.out.println(this.name+" 鐢熶駭浜? "+name);
return new Production(name);
}
}
2.娑堣垂鑰咃細
import java.util.List;
/**
* @author chenlb
*
* 娑堣垂鑰?br />
*/
public class Consumer implements Runnable {
private static int C_ID = 0; //娑堣垂鑰匢D
private List<Product> pool = null;
private String name = "Consumer_"+(++C_ID);
private boolean isRun = true;
public Consumer(List<Product> pool) {
this.pool = pool;
}
public void run() {
// TODO 娑堣垂鑰呯嚎紼?br />
//int pi = 0;
while(isRun) {//&& pi<10
//pi++;
synchronized (pool) {
if(pool.size() < 1) {
try {
System.out.println(name+" 絳夊緟!");
pool.notifyAll(); //閫氱煡綰跨▼(涓昏鏄敓浜ц?浣嗕篃浼氶氱煡鍒扮敓浜ц呯嚎紼?
pool.wait();
} catch (InterruptedException e) {
isRun = false;
System.out.println(name+" thread interrupt!");
}
} else {
Product p = pool.remove(0); //娑堣垂
printProduct(p);
}
}
try {
Thread.sleep(1000); //璋冭瘯鐢?/span>
} catch (InterruptedException e) {
System.out.println(name+" sleep 1s thread interrupt");
}
}
System.out.println(name+" end! pool size: "+pool.size());
}
private void printProduct(Product p) {
System.out.println(name+" 娑堣垂浜? "+p.getName());
}
}
3.Demo
import java.util.LinkedList;
import java.util.List;
/**
* @author chenlb
*
*/
public class Sale {
public static void main(String[] args) {
//閾捐〃浜у搧姹?/span>
List<Product> pool = new LinkedList<Product>();
//涓や釜鐢熶駭鑰?/span>
Producer p1 = new Producer(pool);
Producer p2 = new Producer(pool);
Thread tp1 = new Thread(p1);
Thread tp2 = new Thread(p2);
tp1.start();
tp2.start();
//涓や釜娑堣垂鑰?/span>
Consumer c1 = new Consumer(pool);
Consumer c2 = new Consumer(pool);
Thread tc1 = new Thread(c1);
Thread tc2 = new Thread(c2);
tc1.start();
tc2.start();
}
}
娉ㄦ剰錛氱瓑寰呮椂鍊欒鐢╬ool.wait()鍥犱負鍚屾鐨勬槸pool銆傚惁鍒欎細鎶涘嚭java.lang.IllegalMonitorStateException
^_^
浠g爜涓嬭澆
]]>
閮ㄥ垎浠g爜錛?br />
<mkdir dir="${deploy.applet.dir}" />
<javac destdir="${deploy.applet.dir}" encoding="UTF-8" source="1.4"
srcdir="${src.java.dir}" includes="**/applet/**/*.java">
<classpath refid="project.classpath" />
</javac>
</target>
鍚屾椂涔熺浉澶嶅埗鐗瑰畾瀛愮洰褰曚笅鐨勬枃浠跺す錛?br />
<copy todir="${deploy.applet.dir}" preservelastmodified="true">
<fileset dir="${build.java.dir}">
<include name="**/applet/**/*.class"/>
</fileset>
</copy>
</target>
涓や釜閮界敤鍒癷nclue鏂逛究銆?
]]>
^_^
]]>
璇村埌鐢?br />
<set-property property="cancellable" value="true"/>
鍙互瑙e喅錛岄┈涓婂鍒跺幓璇曚笅錛岃鍠旓紝^_^銆?br />
---------------------------------寮曠敤--------------------------------------
<action path="/fooAction"
input="/foo.jsp"
validate="true">
<set-property property="cancellable" value="true"/>
<forward name="success" path="/bar.jsp"/>
</action>
<action path="/fooAction"
input="/foo.jsp"
validate="true"
cancellable="true">
<forward name="success" path="/bar.jsp"/>
</action>
<action path="/fooAction"
input="/foo.jsp"
validate="true"
cancellable="true">
<forward name="success" path="/bar.jsp"/>
<exception key="errors.cancel"
type="org.apache.struts.action.InvalidCancelException"
path="/foo.jsp"/>
</action>
鍒氬ソ鎴戠敤鐨勬槸struts鏄?.2.9鐨?br />
鍘熸枃錛?a href="http://www.tkk7.com/freiberg/archive/2007/10/20/154384.html">http://www.tkk7.com/freiberg/archive/2007/10/20/154384.html
]]>
ClassNotFoundException: org.hibernate.hql.ast.HqlToken 閿欒weblogic寮傚父閫鍑恒?
鍘熷洜:
Hibernate3.0 閲囩敤鏂扮殑鍩轟簬ANTLR鐨凥QL/SQL鏌ヨ緲昏瘧鍣紝鍦℉ibernate鐨勯厤緗枃浠朵腑錛宧ibernate.query.factory_class灞炴х敤鏉ラ夋嫨鏌ヨ緲昏瘧鍣ㄣ?
錛?錛夐夋嫨Hibernate3.0鐨勬煡璇㈢炕璇戝櫒錛?
hibernate.query.factory_class= org.hibernate.hql.ast.ASTQueryTranslatorFactory
錛?錛夐夋嫨Hibernate2.1鐨勬煡璇㈢炕璇戝櫒
hibernate.query.factory_class= org.hibernate.hql.classic.ClassicQueryTranslatorFactory
涓轟簡浣跨敤3.0鐨勬壒閲忔洿鏂板拰鍒犻櫎鍔熻兘錛屽彧鑳介夋嫨錛?錛夊惁鍒欎笉鑳借В閲婃壒閲忔洿鏂扮殑璇彞錛屽綋浣跨敤鐨勬椂鍊欏嚭鐜頒簡涓嶆敮鎸佹潯浠惰緭鍏ヤ腑鏂囩殑鎯呭喌銆傞夋嫨錛?錛夊彲浠ユ敮鎸佽緭鍏ヤ腑鏂囷紝浣嗘病娉曡В閲婃壒閲忔洿鏂拌鍙ヤ簡
鍦╤ibernate3涓渶瑕佺敤鍒癮ntlr錛岀劧鑰岃繖涓寘鍦╳eblogic.jar涓凡緇忓寘鍚簡antrl綾誨簱錛屽氨浼氫駭鐢熶竴浜涚被鍔犺澆鐨勯敊璇紝鏃犳硶鎵懼埌鍦╳ar鎴栬卐ar涓殑hibernate3.jar銆?
鍑虹幇榪欎釜閿欒涔嬪悗錛宎ntlr浼氳皟鐢⊿ystem.exit()錛岃繖鏍穡eblogic灝變細涓鏈嶅姟銆?
瑙e喅鏂規硶:
1.鏄湪hibernate.properties鏂囦歡涓鍔犲睘鎬э細hibernate.query.factory_class錛屽睘鎬х殑鍊兼槸org.hibernate.hql.classic.ClassicQueryTranslatorFactory錛岃繖鏍峰氨鍙互瑙e喅闂浜嗐?
浣嗘槸閮ㄥ垎鍔熻兘浼氭湁闂錛岃濡?
浣嗘湰緋誨湪鎵歸噺鍒犻櫎鍜屾洿鏂頒細鏈夐棶棰?鏈郴緇熶笉閲囩敤
2.灝哸ntlr-2.7.5H3.jar鍒癢eblogic鐨刾re_Classpath :鐢╓inRar鎴朩inzip鎵撳紑C:\bea\weblogic81\server\lib\weblogic.jar 鍒犻櫎閲岄潰鐨刟ntlr鐩綍, 鐒跺悗鍐峚ntlr-2.7.5H3.jar鏀懼湪weblogic.jar鐨勫悓涓鐩綍(娉?鏇挎崲涔嬪悗娌″仛鍋氳繃涓ユ牸嫻嬭瘯,灝氫笉鐭ユ槸鍚︽湁鍚庨仐鐥?
3. 1銆佹嫹璐滺ibernate3閲屽甫鐨勫寘antlr-2.7.5H3.jar鍒?WL_HOME%\server\lib涓?
2銆佷慨鏀? mydomain% \ startWebLogic.cmd 錛?
鍦╯et CLASSPATH涔嬪墠鍔犱笂涓嬮潰涓鍙ワ細
set PRE_CLASSPATH=%WL_HOME%\server\lib\antlr-2.7.5H3.jar;
鍦╯et CLASSPATH涔嬪悗鍔犱笂涓嬮潰涓鍙ワ細
set CLASSPATH=%PRE_CLASSPATH%;%CLASSPATH%
涓鍒嘜K錛?
鍏蜂綋鍘熷洜鍙弬鐓ф欏碉細http://dev2dev.bea.com/blog/pmalani/archive/2005/07/configuring_web.html
鎴戠敤antlr-2.7.6.jar鍙互錛屾垜鐢ㄧ殑hibernate3.2.3ga
鍑虹幇閿欒濡備笅:
<
鍏堣涓嬫垜閰嶇疆
1.鐜錛?/p>
spring 2.0.6錛宧ibernate 3.2.3錛宻truts 1.2.9錛宱racle 10.2錛寃eblogic 8.1.4
jdbc鏄痮jdbc14.jar
2.榪炴帴姹犵敤DBCP
鍙﹀錛屾病鏈夌敤OpenSessionInViewFilter錛宻truts涓巗pring鐨勬暣鍚堬細DelegatingRequestProcessor銆乤ction path涓巄ean name鍚屽悕銆?/font>
緲婚〉涓嶈繃10嬈★紝鏈嶅姟鍣ㄥ氨娌″搷搴斾簡錛屾渶鍚庡嚭鐜頒笂闈㈢殑閿欒鐨勪簡銆?/font>
鍒氱敤weblogic錛屼篃鍒氱敤ssh濂楅銆傞儊闂楓?br />
鍓嶅ぉ瑙e喅浜嗐?br />
闂瑙e喅錛岄棶棰樼殑鍘熷洜鏄暟鎹簱榪炴帴鑰楀敖錛屾垜鐢℉iberanteDaoSupport鐨刧etSession()鏂規硶鍙栧緱Session鍚庢病鏈夐噴鏀維ession銆?/p>
鍑洪棶棰樼殑浠g爜澶勶紙綰㈣壊閮ㄥ垎錛夛細
鐢ㄥ畬Session閲婃斁鍚庡氨娌′簨浜嗭紝璋冪敤HiberanteDaoSupport鐨?font face="Arial">releaseSession(session);鏂規硶鍚庡嵆鍙В鍐熾?/font>
鐜板湪姝g‘鐨勪唬鐮侊細
鍥犱負ms word鍜宔xcel鐨勬枃妗i兘鏀寔html鏂囨湰鏍煎紡錛屽洜姝ゅ彲浠ュ厛鐢╳ord鎴杄xcel鍋氬ソ妯$増錛屽彟瀛樹負web欏碉紝鐒跺悗灝嗚html鏀規垚jsp錛屽皢鏁版嵁閮ㄥ垎鍔ㄦ佸~鍏ュ嵆鍙紝涓嶇敤寰堣緵鑻︾殑璋冩暣鏍煎紡 銆?/p>
word欏甸潰鍙鍦╦sp澶磋緗涓嬫寚浠わ細
<%@page contentType="application/msword;charset=gb2312" %>
excel濡備笅錛?
<%@page contentType="application/vnd.ms-excel;charset=gb2312" %>