Servlet中的代码:
package com.snack.pay;
import java.io.IOException;
import java.sql.Connection;
import java.util.ArrayList;
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.snack.model.Orderinfo;
import net.sf.json.JSONArray;
/**
* 日收益的Servlet
*/
public class DaysinfoServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private DaysinfoDao powerDao=new DaysinfoDao();
private DbUtil dbUtil=new DbUtil();
/**
* @see HttpServlet#HttpServlet()
*/
public DaysinfoServlet() {
super();
// TODO Auto-generated constructor stub
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
this.doPost(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
// billdata 是对账的日期
String billdata = request.getParameter("billdata");
response.getWriter().append("内容: "+billdata).append(request.getContextPath());
System.out.println("内容:"+billdata);
}
}
URL地址:
http://localhost:8080/SnackShop/DaysinfoServlet?billdata=”2019-4-7“