javaÉú³Éxml¸ñʽÊý¾Ý
//»ñÈ¡Êý¾Ý¿âÊý¾Ý·µ»Ølist
public List queryAll(int fcateId) {
List list = new ArrayList();
String sql = "select * from g_Account where fCateID=? order by fCode";
Connection con = SqlHelp.getConn();//»ñµÃÁ¬½Ó£¬sqlhelp×Ô¼ºÐ´µÄ¹¤¾ßÀà
PreparedStatement pst = null;
ResultSet rs = null;
try {
pst = con.prepareStatement(sql);
pst.setInt(1, fcateId);
rs = pst.executeQuery();
while (rs.next()) {
GAccount ga=new GAccount();
ga.setFCode(rs.getString("fCode"));
ga.setFName(rs.getString("fName"));
ga.setFCateID(rs.getInt("fCateID"));
ga.setFLevel(rs.getInt("fLevel"));
ga.setFParent(rs.getString("fParent"));
ga.setFIsDetail(rs.getInt("fIsDetail"));
list.add(ga);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
SqlHelp.colseConn(con, pst, rs);
}
return list;
}
//´Ë·½·¨Êǹؼü£¨»ñÈ¡tree½á¹¹£©
public String getTree(int fcateId){
StringBuffer sb=new StringBuffer();
List gas=this.queryAll(fcateId);
String fparent="";
String fcode="";
int flevel=0;
//sb.append("<node>\r");
for (Iterator iterator = gas.iterator(); iterator.hasNext();) {
GAccount ga = (GAccount) iterator.next();
if (!ga.getFParent().equals(fparent)) {
if (!ga.getFParent().equals(fcode)) {
sb.append("\r"+getT("\t",ga.getFLevel())+"</node>\r");
for (int i = 1; i < flevel - ga.getFLevel(); i++) {
sb.append("\r\t</node>\r");
}
}
}
if(ga.getFLevel()==1){
sb.append("<node label=\"");
sb.append(ga.getFCode()+"-"+ga.getFName());
sb.append("\" id=\""+ga.getFCode()+"\">\r");
if(ga.getFIsDetail()==1){
sb.append("</node>\r");
}
}else{
if(ga.getFIsDetail()==1){
sb.append(""+getT("\t", ga.getFLevel())+"<node label=\"");
sb.append(ga.getFCode()+"-"+ga.getFName());
sb.append("\" id=\""+ga.getFCod
Ïà¹ØÎĵµ£º
Java½Ó¿ÚÓë³éÏóÀàµÄ±È½Ï
1¡¢ ×î´óµÄÇø±ð£ºjava³éÏóÀà¿ÉÒÔÌṩijЩ·½·¨µÄ²¿·ÖʵÏÖ£¬¶øjava½Ó¿Ú²»¿ÉÒÔ¡£
Èç¹ûÏòÒ»¸ö³éÏóÀàÀï¼ÓÈëÒ»¸öеľßÌå·½·¨£¬ÄÇôËûËùÓеÄ×ÓÀ඼һÏÂ×ӵõ½ÁËÕâ¸öз½·¨£¬¶øjava½Ó¿Ú×ö²»µ½ÕâÒ»µã¡£Èç¹ûÏòÒ»¸öjava½Ó¿ÚÀïÃæ¼ÓÈëÒ»¸öз½·¨£¬ËùÓÐʵÏÖÕâ¸ö½Ó¿ÚµÄÀà¾ÍÎÞ·¨³É¹¦Í¨¹ý±àÒëÁË£¬ÒòΪ±ØÐëÈà ......
ÒªÀí½â javaÖÐStringµÄÔË×÷·½Ê½£¬±ØÐëÃ÷È·Ò»µã£ºStringÊÇÒ»¸ö·Ç¿É±äÀࣨimmutable£©¡£Ê²Ã´ÊǷǿɱäÀàÄØ£¿¼òµ¥ËµÀ´£¬·Ç¿É±äÀàµÄʵÀýÊDz»Äܱ»Ð޸ĵģ¬Ã¿¸öʵÀýÖаüº¬µÄÐÅÏ¢¶¼±ØÐëÔÚ¸ÃʵÀý´´½¨µÄʱºò¾ÍÌṩ³öÀ´£¬²¢ÇÒÔÚ¶ÔÏóµÄÕû¸öÉú´æÖÜÆÚÄڹ̶¨²»±ä¡£javaΪʲôҪ°ÑStringÉè¼ÆΪ·Ç¿É±äÀàÄØ£¿Äã¿ÉÒÔÎÊÎÊ james Gosling £º£©¡£µ ......
1. Ê×ÏÈString²»ÊôÓÚ8ÖÖ»ù±¾Êý¾ÝÀàÐÍ£¬StringÊÇÒ»¸ö¶ÔÏó¡£
ÒòΪ¶ÔÏóµÄĬÈÏÖµÊÇnull£¬ËùÒÔStringµÄĬÈÏÖµÒ²ÊÇnull£»µ«ËüÓÖÊÇÒ»ÖÖÌØÊâµÄ¶ÔÏó£¬ÓÐÆäËü¶ÔÏóûÓеÄһЩÌØÐÔ¡£
2. new String()ºÍnew String(“”)¶¼ÊÇÉêÃ÷Ò»¸öеĿÕ×Ö·û´®£¬ÊÇ¿Õ´®²»ÊÇnull£»
3. String str=”kvill”£»
String str=n ......
±ðÉùÃ÷£ºÕâÊÇһƪÀ´×ÔwudaleµÄ²©¿ÍµÄÎÄÕÂhttp://wudale.bokee.com/3594651.html
JavaÊÇÄ¿Ç°×îÁ÷ÐеÄÃæÏò¶ÔÏóµÄ±ä³ÉÓïÑÔÖ®Ò»£¬JavaÖ§UTF£8£¬ISO£8859£1¡¢GBKµÈ¸÷ÖÖ×ÖÌå±àÂ룬¿É±ÊÕß·¢ÏÖJavaÖÐ×ÖÌå±àÂëµÄÎÊÌâÈÔÀ§µ¹Á˲»ÉÙ³ÌÐòÔ±£¬ÍøÉÏËäÈ»Ò²Ó ......