在一个文本框里输入 比如100 然后导出 100条 xml文件
可是 输入 10万条以上的就不行了。我应该用什么方法?怎么写,请大家赐教。谢谢
下面是代码
public List<Node> outSendbackXML(int sendNum) {
Random random = new Random();

List<SendbackBean> sendBackBeanList = new ArrayList<SendbackBean>(sendNum);
for (int i = 0; i < sendNum; i++) {
SendbackBean bean = new SendbackBean();
long random2 = new Random().nextInt(4)+1;
bean.setUser_no(random2);
bean.setIp(random.nextInt() + "");
bean.setMac(random.nextInt()+"");
bean.setPort(random.nextLong());
sendBackBeanList.add(bean);
}

List<Node> rootNextNodes = new ArrayList<Node>();
SendbackBean lastBean = null;
List<Node> ipListNextNodes = null;
for(SendbackBean bean: sendBackBeanList) {
if(lastBean == null || lastBean.getUser_no() != bean.getUser_no()) {
ipListNextNodes = new ArrayList<Node>();
Node userNoNode = new Node("user_no", bean.getUser_no().toString(), null);
List<Node> ruleNextNodes = new ArrayList<Node>();
ruleNextNodes.add(userNoNode);

Node ipListNode = new Node("ip_list", null, ipListNextNodes); 
ruleNextNodes.add(ipListNode);
Node ruleNode = new Node("rule", null, ruleNextNodes);
rootNextNodes.add(ruleNode);
}
lastBean = bean; 
List<Node> nextNodes = new ArrayList<Node>();
Node ipNode = new Node("ip", bean.getIp(), null);
nextNodes.add(ipNode);
Node portNode = new Node("port", bean.getPort().toString(), null);
nextNodes.add(portNode);
Node macNode = new Node("mac", bean.getMac(), null);
nextNodes.add(macNode);
Node nodeNode = new Node("node",null, nextNodes);
ipListNextNodes.add(nodeNode);
}
return rootNextNodes;
}
这个是Action 里的代码
public ActionForward outputXML(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) 
throws Exception {
  String storePath = request.getParameter("storePath");
  String sendbackPath = request.getParameter("sendbackPath");
  String tup5_ful = request.getParameter("tup5_ful");
  String tup5_inc = request.getParameter("tup5_inc");
  String Num = request.getParameter("Num");
  int i = Integer.parseInt(Num);
  List<Node> sendback = outputXMLService.outSendbackXML(i);
List<Node> store = outputXMLService.consStoreXML(i);
List<List<Node>> tup5rule = outputXMLService.outTup5XML(i);
XmlOperator.saveXml(storePath, store);
XmlOperator.saveXml(sendbackPath, sendback);
XmlOperator.saveXml(tup5_inc, tup5rule.get(0));
XmlOperator.saveXml(tup5_ful, tup5rule.get(1));

request.setAttribute("OK", "OK");
return new ActionForward("/outputXML/outputxml.jsp");
}
页面<html> <head>
<base href="<%=basePath%>">
<title>My JSP 'RightFrame.jsp' starting page</title>
<script type="text/javascript">
function writer() { var url1 = document.getElementById("storePath").value;
var url2 = document.getElementById("sendbackPath").value;
var url3 = document.getElementById("tup5_ful").value;
var url4 = document.getElementById("tup5_inc").value;
var url7 = document.getElementById("Num").value;  
window.location.href = "outxml.do?method=outputXML&storePath=" + url1+ "&Num=" + url7+ "&sendbackPath=" + url2+ "&tup5_ful=" + url3 + "&tup5_inc="+ url4;
// + "&tup5_ful=" + url2 + "&tup5_ful=" + url3 + "&tup5_inc="
//+ url4 + "&Tup5Num=" + url7;
}
var ok = "${OK}";
if (ok.length > 0) {
alert("XML文件导出成功");
}
</script> </head> <body>
<table width="378" height="90" border="1" bordercolor="#999999"
bgcolor="#FFFFFF">
<tr>
<th width="214" colspan="">
OutputXML
</th>
</tr>
<tr>
<th rowspan="1">
路径1:
<input type="text" name="storePath" id="storePath"
value="d:/opt/327/bin/sysconf/store_back.xml" style="width: 220px" />
</th>
<th rowspan="1">
路径2:
<input type="text" name=sendbackPath id="sendbackPath"
value="d:/opt/327/bin/sysconf/user_back.xml" style="width: 220px" />
</th>
</tr>
<tr>
<th rowspan="1">
路径3:
<input type="text" name="tup5_ful" id="tup5_ful"
value="d:/opt/327/bin/sysconf/id_bind_ful.xml"
style="width: 220px" />
</th>
<th rowspan="1">
路径4:
<input type="text" name="tup5_inc" id="tup5_inc"
value="d:/opt/327/bin/sysconf/tup5_ful.xml" style="width: 220px" />
</th>
</tr>
<tr>
<th>
<input type="text" name="Num" id="Num" value="100"/>
记录
</th>
<th>
<button onclick=writer();>导出XML</button>
</th>
</tr>
</table>
</body>
</html>