jsp生成xml文件,最好能给一个能运行的程序。 就是把一个input中的输入的内容,放到一个自动生成的xml格式的文件中。本人分是有的,就看各位的诚意了。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我可以给你一个生成XML的,具体你根据你的情况自己改一下吧Element root = new Element("integral-event"); Document myDocument = new Document(root); for(int i=0;i<list1.size();i++){ Map map=(Map)list1.get(i); root.addContent(new Element(map.get("type").toString()) .addContent(new Element("name").addContent(map.get("name").toString())) .addContent(new Element("value").addContent(map.get("value").toString())) .addContent(new Element("description").addContent(map.get("description").toString()))); } XMLOutputter xmlOut = new XMLOutputter(Format.getPrettyFormat().setEncoding("GBK")); try { xmlOut.output(myDocument, System.out); FileWriter writer = new FileWriter("C://aaa//bbb.xml"); xmlOut.output(myDocument, writer); writer.close(); } catch (IOException e) { e.printStackTrace(); }我是根据一个取到的LIST生成的XML 其实没有那么复杂,先确定这个xml文件是不是存在,如果存在就直接写放就可以了,为了方便快速,我用 的是filewriter("abc.xml")然后就是拼写xml格式的文档了,不过要注意的是如果不存在,一这定要先建立再写就可以了。 关于表格的排序 回复HTML脚本问题怎么解决? 怎么让hibernate中让log4j起作用呀? 正则表达式问题 请教 Hibernate分页问题 web service和seb server 有什么区别 如何将struts项目发布到websphere(5.0)上 struts如何一次提交多个表单 请问怎样在WebSphere下部署和发布EJB????? jsp的session.getAttribute()在不同的jsp页面显示null ssh架构,报错Context initialization failed请问这是什么错误 用网页登陆后台反映慢问题,问题解决马上给分
Element root = new Element("integral-event");
Document myDocument = new Document(root);
for(int i=0;i<list1.size();i++){
Map map=(Map)list1.get(i);
root.addContent(new Element(map.get("type").toString())
.addContent(new Element("name").addContent(map.get("name").toString()))
.addContent(new Element("value").addContent(map.get("value").toString()))
.addContent(new Element("description").addContent(map.get("description").toString())));
}
XMLOutputter xmlOut = new XMLOutputter(Format.getPrettyFormat().setEncoding("GBK"));
try {
xmlOut.output(myDocument, System.out);
FileWriter writer = new FileWriter("C://aaa//bbb.xml");
xmlOut.output(myDocument, writer);
writer.close();
} catch (IOException e) {
e.printStackTrace();
}我是根据一个取到的LIST生成的XML