Total Pageviews

2011/03/25

Implementing a simple toString() with Apache Commons

我們在Web開發的時候,JSP頁面參數是透過form bean傳遞,有時候需要印出form bean裡頭的valuedebug,大家可以在form bean中,override toString(),如以下寫法

public String toString() {

return ToStringBuilder.reflectionToString(this);

}

實作如下

public static void main(String[] args) {

// set value to value object

Nigw002PK vo = new Nigw002PK();

vo.setCarryDate("1");

vo.setCarrySeqNo("2");

vo.setCaseStus("3");

vo.setMtgTp("4");

// print value object by toString()

System.out.println(vo.toString());

}

印出結果入下:gov.fdc.nig.domain.Nigw002PK@63396339[mtgTp=4,caseStus=3,taxCd=,carryDate=1,carrySeqNo=2,vioNo=>]

Reference: http://blogs.bytecode.com.au/glen/2007/10/05/implementing-a-simple-tostring---with-apache-commons.html

2011/03/24

Apply MyEclipse to do entity class generation

Check out this SlideShare Presentation:

NIG Project setup quickly tutorial


2011/03/16

WTRN0037W: The transaction service encountered an error on an xa_recover operation


As I start up WAS(WebSphere Application Server) V7, it show error messages as bellows:
[2011/3/16 17:30:48:784 CST] 0000000b XARminst E WTRN0037W: The transaction service encountered an error on an xa_recover operation. The resource was com.ibm.ws.rsadapter.spi.WSRdbXaResourceImpl@702d702d. The error code was XAER_RMERR. The exception stack trace follows: javax.transaction.xa.XAException
at oracle.jdbc.xa.OracleXAResource.recover(OracleXAResource.java:709)
at com.ibm.ws.rsadapter.spi.WSRdbXaResourceImpl.recover(WSRdbXaResourceImpl.java:1044)
at com.ibm.ws.Transaction.JTA.XARminst.recover(XARminst.java:140)
at com.ibm.ws.Transaction.JTA.XARecoveryData.recover(XARecoveryData.java:571)
at com.ibm.tx.jta.PartnerLogTable.recover(PartnerLogTable.java:389)
at com.ibm.tx.jta.RecoveryManager.resync(RecoveryManager.java:1523)
at com.ibm.ws.tx.jta.RecoveryManager.performResync(RecoveryManager.java:126)
at com.ibm.tx.jta.RecoveryManager.run(RecoveryManager.java:2200)
at java.lang.Thread.run(Thread.java:735)

Solution
1. Shut down WAS(WebSphere Application Server) V7

2. Change directory to transaction logs foldler: [WebSphere Application Server_install_root]\profiles\[PROFILE_NAME]\tranlog\[CELL_NAME]\[NODE_NAME]\[SERVER_NAME]\transaction


3. Delete all folder and files

4. Start up server again

5. Do not have error message any more

6. And log into admin console successfully.

2011/03/03

如何在Word中建立書籤及超連結

建立書籤與超連結

1. 將要做書籤的文字進行反白

2. 插入-->書籤

3. 輸入書籤名稱-->新增


4. 把要做超連結的文字進行反白

5. 按下書籤按鈕

6. 選擇剛剛建立的書籤 --> 確定



測試

1. 點選超連結


2. 正確連結到該頁面,大成功!