好就没来了啊 java 生成xml的问题
Message.java
package com.xintong.action.test;
import com.xintong.action.sqlcon;
public class Message {
public void init(javax.servlet.jsp.JspWriter out,javax.servlet.http.HttpServletResponse response) throws Exception {
response.setContentType( "text/xml;charset=GB2312 ");
out.println( " <?xml version=\ "1.0\ " encoding=\ "GB2312\ "?> ");
out.println( " <rss> ");
out.println( " <root> ");
}
public void Message(javax.servlet.jsp.JspWriter out,int id) throws Exception {
sqlcon sqlbean=new sqlcon();
sqlbean.executeQuery( "select * from test_menu where menu_id= ' "+id+ " ' ");
int totalmsg=sqlbean.getTotalNum();
out.println( " <count> "+totalmsg+ " </count> ");
out.println( " </root> ");
out.println( " </rss> ");
sqlbean.close();
}
}
message.jsp
<jsp:useBean id= "showMsg " scope= "request " class= "com.xintong.action.test.Message "/>
<jsp:setProperty name= "showMsg " property= "* "/>
<%
showMsg.init(out,response);
showMsg.Message(out,81);
%>
现在点击message.jsp
页面只显示个
1
查看源代码是
<?xml version= "1.0 " encoding= "GB2312 "?>
<rss>
<root>
<count> 1 </count>
</root>
</rss>
杂让他显示成这种啊
<?xml version= "1.0 " encoding= "GB2312 " ?>
- <root>
<count> 1 </count>
</root>
急啊!
------解决方案--------------------给大家介绍个技术群
大家一起学习,一起提高
12865014