org.jdom.contrib.input.ResultSetBuilder aa = new org.jdom.contrib.input.ResultSetBuilder(ResultSet rs); aa.build().toString();
/* * Created on 2005-8-14 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ package com.motel168.ws;import java.io.IOException; import java.io.PrintWriter;import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;/** * @author qiyadeng * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class CreateXML extends HttpServlet { /** * Constructor of the object. */ public CreateXML() { super(); } /** * Destruction of the servlet. <br> */ public void destroy() { super.destroy(); // Just puts "destroy" string in log // Put your code here } /** * The doGet method of the servlet. <br> * * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/xml;charset=GB2312"); PrintWriter out = response.getWriter(); out.println("<?xml version=\"1.0\" encoding=\"GB2312\"?>"); out.println("<root>"); out.println("<user>"); out.println("<username>qiya</username>"); out.println("<password>qiya</password>"); out.println("</user>"); out.println("<user>"); out.println("<username>qiyadeng</username>"); out.println("<password>qiyadeng</password>"); out.println("</user>"); out.println("</root>"); out.flush(); out.close();} /** * The doPost method of the servlet. <br> * * This method is called when a form has its tag value method equals to post. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } /** * Initialization of the servlet. <br> * * @throws ServletException if an error occure */ public void init() throws ServletException { // Put your code here }}
一般使用DOM4J
aa.build().toString();
* Created on 2005-8-14
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package com.motel168.ws;import java.io.IOException;
import java.io.PrintWriter;import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;/**
* @author qiyadeng
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class CreateXML extends HttpServlet { /**
* Constructor of the object.
*/
public CreateXML() {
super();
} /**
* Destruction of the servlet. <br>
*/
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
} /**
* The doGet method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to get.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException { response.setContentType("text/xml;charset=GB2312");
PrintWriter out = response.getWriter();
out.println("<?xml version=\"1.0\" encoding=\"GB2312\"?>");
out.println("<root>");
out.println("<user>");
out.println("<username>qiya</username>");
out.println("<password>qiya</password>");
out.println("</user>");
out.println("<user>");
out.println("<username>qiyadeng</username>");
out.println("<password>qiyadeng</password>");
out.println("</user>");
out.println("</root>");
out.flush();
out.close();} /**
* The doPost method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to post.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException { } /**
* Initialization of the servlet. <br>
*
* @throws ServletException if an error occure
*/
public void init() throws ServletException {
// Put your code here
}}
從數據庫裏讀齣來在處理下就好暸
哥们
你这个方法我也会
这个不是太好吧
不过还是给你100分
到结帐的时候来取下面各位来个让我动心的