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("<");会把<转为<输出到文件。
-
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(); } }
树型排列:









