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ÏîÄ¿»¹ÊÇwebÏîÄ¿£©
String relativelyPath=System.getProperty("user.dir");
ÉÏÊöÏà¶Ô·¾¶ÖУ¬javaÏîÄ¿ÖÐµÄ ......
package innerClass.test;
public class InheritTest
{
public static void main(String[] args)
{
Person p = new Person("LMS");
p.show();
  ......
ÒªÀí½â javaÖÐStringµÄÔË×÷·½Ê½£¬±ØÐëÃ÷È·Ò»µã£ºStringÊÇÒ»¸ö·Ç¿É±äÀࣨimmutable£©¡£Ê²Ã´ÊǷǿɱäÀàÄØ£¿¼òµ¥ËµÀ´£¬·Ç¿É±äÀàµÄʵÀýÊDz»Äܱ»Ð޸ĵģ¬Ã¿¸öʵÀýÖаüº¬µÄÐÅÏ¢¶¼±ØÐëÔÚ¸ÃʵÀý´´½¨µÄʱºò¾ÍÌṩ³öÀ´£¬²¢ÇÒÔÚ¶ÔÏóµÄÕû¸öÉú´æÖÜÆÚÄڹ̶¨²»±ä¡£javaΪʲôҪ°ÑStringÉè¼ÆΪ·Ç¿É±äÀàÄØ£¿Äã¿ÉÒÔÎÊÎÊ james Gosling £º£©¡£µ ......
ְλÃèÊö£º
1¡¢°´USECASE½øÐÐÒµÎñÐèÇó·ÖÎöºÍÈí¼þ¸ÅÒªÉè¼Æ£»
2¡¢½øÐÐÈí¼þÏêϸÉè¼ÆºÍ±àÂëʵÏÖ£¬È·±£ÐÔÄÜ¡¢ÖÊÁ¿ºÍ°²È«£»
3¡¢Î¬»¤ºÍÉý¼¶ÏÖÓÐÈí¼þ²úÆ·£¬¿ìËÙ¶¨Î»²¢ÐÞ¸´ÏÖÓÐÈí¼þȱÏÝ¡£
ְλҪÇó£º
1¡¢¾«Í¨Web±à³Ì£¬3ÄêÒÔÉÏʹÓÃJavaÓïÑÔ½øÐÐweb¿ª·¢µÄ¾Ñ飬ÊìϤhtml£¬javascript¡£
2¡¢¾«Í¨jsp£¬servlet£¬java bean£¬JM ......