Package action

Source Code of action.FetchServlet

package action;
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 net.sf.json.JSONArray;

import model.Node;

import util.IbatisUtil;


public class FetchServlet extends HttpServlet {
  public void doGet(HttpServletRequest request,
        HttpServletResponse response) throws IOException,ServletException{
    String date = request.getParameter("date").trim();
    PrintWriter out = response.getWriter();
    if(date == "" ){
      out.print("{error:1}");
      return;
    }
    List<Node> nodes = null;
    try{
      nodes = IbatisUtil.getNode(date);
    }catch(Exception e){
     
    }
    String outs = "";
    int size = nodes.size();
    JSONArray ja = JSONArray.fromObject(nodes);
    out.print(ja.toString());
  }
  public void doPost(HttpServletRequest request,
        HttpServletResponse response)throws IOException,ServletException{
   
  }
 
}
TOP

Related Classes of action.FetchServlet

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.