📄 statall.java
字号:
package com.jxc.servlet.stat;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.jxc.dao.Conn;
import com.jxc.dao.Stat;
import com.jxc.vo.StatM;
public class StatAll extends HttpServlet {
/**
* Constructor of the object.
*/
public StatAll() {
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 {
this.doPost(request, response);
}
/**
* 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 {
HttpSession session=request.getSession();
int in=0;
int inback=0;
int out=0;
int reject=0;
int outback=0;
Connection conn1=Conn.getConnection();
Connection conn2=Conn.getConnection();
Connection conn3=Conn.getConnection();
Connection conn4=Conn.getConnection();
Connection conn5=Conn.getConnection();
String dd1=request.getParameter("d1");
String dd2=request.getParameter("d2");
java.sql.Date d1=null;
java.sql.Date d2=null;
if("".equals(dd1)||"".equals(dd1)){
session.setAttribute("erro", "null");
response.sendRedirect("statall.jsp");
}else{
try {
d1=java.sql.Date.valueOf(dd1);
d2=java.sql.Date.valueOf(dd2);
} catch (Exception e) {
// TODO Auto-generated catch block
session.setAttribute("erro", "erro");
response.sendRedirect("statall.jsp");
return;
}
in=new Stat().StatInM(conn1, d1, d2);
inback=new Stat().StatInbackM(conn2, d1, d2);
out=new Stat().StatOutM(conn3, d1, d2);
outback=new Stat().StatOutbackM(conn4, d1, d2);
reject=new Stat().StatRejectM(conn5, d1, d2);
StatM stat=new StatM();
stat.setIn(in);
stat.setInback(inback);
stat.setOut(out);
stat.setOutback(outback);
stat.setReject(reject);
int li=(out+inback)-(in+reject+outback);
session.setAttribute("stat", stat);
session.setAttribute("lirun", li);
response.sendRedirect("statall.jsp");
}
}
/**
* Initialization of the servlet. <br>
*
* @throws ServletException if an error occurs
*/
public void init() throws ServletException {
// Put your code here
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -