我有一个html表单提交xml作为输出后提交第一个表单xml需要保持l somewere并附加gui刷新后创建的下一个xml如何使用java?
String head = "<dictionary>";
String end = "<dictionary>";
StringBuffer buf = new StringBuffer();
for (int i = 1; i < 2; i++) {
buf.append(xml);
}
String dict = buf.toString();
StringBuffer buffer = new StringBuffer();
buffer.append(head);
buffer.append(dict);
buffer.append(end);
System.out.println(buffer.toString());
答案 0 :(得分:0)
我认为for
循环中的问题只会打印一次,因此您不会在xml字符串中获取第二个值,因此您需要更改索引,如下所示。
String head = "<dictionary>";
String end = "</dictionary>";
StringBuffer buf = new StringBuffer();
for (int i = 0; i < 2; i++) {
buf.append(xml);
}
String dict = buf.toString();
StringBuffer buffer = new StringBuffer();
buffer.append(head);
buffer.append(dict);
buffer.append(end);
System.out.println(buffer.toString());