学习1

1、 ResultSet API中的一句话 A ResultSet object is automatically closed when the Statement object that generated it is closed, re-executed, or used to retrieve the next result from a sequence of multiple results. 当生成 ResultSet 对象的 Statement 对象关闭、重新执行或用来从多个结果的序列检索下一个结果时, ResultSet 对象会自动关闭。 循环中调用Statement.executeUpdate方法,会使数据库游标发生错误,发生更新了几条就更新不了的现象。 循环更新应该使用PreparedStatement.preparedStatment方法。 2、 response.sendRedirect("url");跳转到站内页面时,session.setAttribute();的值可以取得。request中的取不到。 3、 dom4j中,XMLWriter类

write

public void write(String text)
           throws IOException

Print out a String, Perfoms the necessary entity escaping and whitespace stripping.

 

Parameters:
text - is the text to output
Throws:
IOException - DOCUMENT ME!
当使用此方法时注意: write("<");会把<转为&lt;输出到文件。

import java.io.FileWriter; import java.io.IOException; import org.dom4j.Document; import org.dom4j.DocumentHelper; import org.dom4j.io.XMLWriter; public class Test {     public static void main(String[] args) throws IOException{         Document document = DocumentHelper.createDocument();         document.setXMLEncoding("GB2312");         document.addElement("hello").addText("world");         String str = document.asXML();         System.out.println(str);         str= str + "<>";         XMLWriter xmlWriter = new XMLWriter(new FileWriter("D:/testXML.xml"));         xmlWriter.write(str);        //使用下面这句,文件显示正常,“<>"没有被转义。
        //xmlWriter.write(document);         xmlWriter.close();     } }

树型排列:

 

public  List sortList(List list,List returnList,String rootOrgCode) {     for(Iterator it=list.iterator();it.hasNext();){         OrganizeVO org = (OrganizeVO)it.next();         if(rootOrgCode.equals(org.getParentCode())){             returnList.add(org);         sortList(list,returnList,org.getCode());         }     }     return returnList; }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值