📄 objsta.java
字号:
package servlet;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Vector;
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 bean.GetChinaMoney;
import bean.StatisticsObjBean;
public class ObjSta extends HttpServlet {
/**
* 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 doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=GBK");
response.setCharacterEncoding("GBK");
request.setCharacterEncoding("GBK");
PrintWriter out = response.getWriter();
HttpSession session=request.getSession();
StatisticsObjBean sta=new StatisticsObjBean();
Vector v=sta.objsta();
session.setAttribute("staobj", v);
float money=0f;
for(int i=0;i<v.size();i++){
StatisticsObjBean sta1=(StatisticsObjBean)v.get(i);
money=money+Float.parseFloat(sta1.getItemFee());
}
GetChinaMoney get=new GetChinaMoney();
String chinamoney=get.getNumber(String.valueOf(money));
session.setAttribute("allmoney", money);
session.setAttribute("chinamoney", chinamoney);
out
.println("<script language='javascript'>"
+ "parent.mainFrame.location.href='printf/statisticsobj.jsp';</script>");
out.close();
this.destroy();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -