成功不是将来才有的,而是从决定去做的那一刻起,持续累积而成。 上人生的旅途罢。前途很远,也很暗。然而不要怕。不怕的人的面前才有路。
package com.common;
import java.io.IOException; import java.io.PrintWriter; import java.util.List;
import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;
public class DemoTest extends HttpServlet {
private IDemo demo=new Demo();
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response); }
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8"); response.setContentType("text/html"); PrintWriter out = response.getWriter(); int id=Integer.parseInt(request.getParameter("id")); List list=demo.query(id); String json=""; for (int i = 0; i < list.size(); i++) { json+=list.get(i)+","; } System.out.println(json); out.write(json); out.flush(); out.close(); }
}
Powered by: BlogJava Copyright © 艾波