Package servlet

Source Code of servlet.S_TopTenRatio

package servlet;

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;

import com.cedarsoftware.util.io.JsonWriter;

import dao.DaoUser;
import user.User;


public class S_TopTenRatio extends HttpServlet {
  private static final long serialVersionUID = 1L;


  @Override
  public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    doPost(request, response);
  }

  @Override
  public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    response.setContentType("json");
    PrintWriter out = response.getWriter();
    DaoUser dao = new DaoUser();
    List<User> users = dao.getTopTenRatio();
    if(users != null) {
      System.out.println("\t\t\t\tS_TopTenRatio\n" + JsonWriter.objectToJson(users));
      out.print(JsonWriter.objectToJson(users));
    }
    else {
      out.print("{}");
    }
    out.close();
  }
}
TOP

Related Classes of servlet.S_TopTenRatio

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.