最好不要写java,直接jsp语句搞定,有人有办法哇?

解决方案 »

  1.   

    jdom
    我去学习一下。5555555
      

  2.   

    可以使用jstl标签库<%@ taglib prefix="x" uri="http://java.sun.com/jstl/xml" %>前提是需要导入jstl的jar包!
      

  3.   

    我认为jsp和java的用法是一致的
    把我写的一个例子发过来
    希望能有点用import java.io.File;
    import java.util.Iterator;import org.dom4j.Element;
    import org.dom4j.io.SAXReader;
    import org.dom4j.Document;public class dom4j {
    public static void main(String args[])
    {
    long start=System.currentTimeMillis();
    try{
    //指定xml文件
    File f =new File("c:\\what.xml");
    SAXReader sax = new SAXReader();
    Document dc = sax.read(f);
    Element root = dc.getRootElement();
    Element foot;
    for(Iterator i=root.elementIterator("first");i.hasNext();)
    {
    foot = (Element) i.next();
    System.out.print("second:"+foot.elementText("second"));
    System.out.print("third:"+ foot.elementText("third"));
    }
    }catch(Exception e){
    e.printStackTrace();
    }
    long end = System.currentTimeMillis();
    System.out.println("time="+(end-start));

    }
    }