2、設(shè)置Chart默認字體:
如果在非windows系統(tǒng)下使用,可以拷貝windows系統(tǒng)下的simsun.ttc到classes路徑下,重啟服務(wù)器即可顯示中文
然后其他的一些字體大小等都要一個個設(shè)置了,因為默認英文字體大小顯示中文不好看
這樣就可以很完美顯示中文了。比起JFreeChart來好多了,JFreeChart雖然也可以解決中文顯示問題,但是中文字體發(fā)虛,好像目前無法解決。
Archetype | Command |
---|---|
JSF Basic | mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-basic-jsf -DremoteRepositories=http://static.appfuse.org/repository![]() |
Spring MVC Basic | mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-basic-spring -DremoteRepositories=http://static.appfuse.org/repository![]() |
Struts 2 Basic | mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-basic-struts -DremoteRepositories=http://static.appfuse.org/repository![]() |
Tapestry Basic | mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-basic-tapestry -DremoteRepositories=http://static.appfuse.org/repository![]() |
JSF Modular | mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-modular-jsf -DremoteRepositories=http://static.appfuse.org/repository![]() |
Spring MVC Modular | mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-modular-spring -DremoteRepositories=http://static.appfuse.org/repository![]() |
Struts 2 Modular | mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-modular-struts -DremoteRepositories=http://static.appfuse.org/repository![]() |
Tapestry Modular | mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-modular-tapestry -DremoteRepositories=http://static.appfuse.org/repository![]() |
Core (backend only) | mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-core -DremoteRepositories=http://static.appfuse.org/repository![]() |
級聯(lián)的關(guān)閉這聽起來好像很有道理,而且在很多地方這樣做也是正確的,通常這樣寫
Connection con = getConnection();//getConnection is your method
PreparedStatement ps = con.prepareStatement(sql);
ResultSet rs = ps.executeQuery();
……
///rs.close();
///ps.close();
con.close(); // NO!
這
樣做的問題在于Connection是個接口,它的close實現(xiàn)可能是多種多樣的。在普通情況下,你用
DriverManager.getConnection()得到一個Connection實例,調(diào)用它的close方法會關(guān)閉Statement和
ResultSet。但是在很多時候,你需要使用數(shù)據(jù)庫連接池,在連接池中的得到的Connection上調(diào)用close方法的時候,Connection可能并沒有被釋放,而是回到了連接池中。它以后可能被其它代碼取出來用。如果沒有釋放Statement和ResultSet,那么在Connection上沒有關(guān)閉的Statement和ResultSet可能會越來越多,那么……
相反,我看到過這樣的說法,有人把Connection關(guān)閉了,卻繼續(xù)使用ResultSet,認為這樣是可以的,引發(fā)了激烈的討論,到底是怎么回事就不用我多說了吧。
所以我們必須很小心的釋放數(shù)據(jù)庫資源,下面的代碼片斷展示了這個過程
Connection con = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
con = getConnection();//getConnection is your method
ps = con.prepareStatement(sql);
rs = ps.executeQuery();
///...........
}
catch (SQLException ex) {
///錯誤處理
}
finally{
try {
if(ps!=null)
ps.close();
}
catch (SQLException ex) {
///錯誤處理
}
try{
if(con!=null)
con.close();
}
catch (SQLException ex) {
///錯誤處理
}
}
很麻煩是不是?但為了寫出健壯的程序,這些處理是必須的。