每日总结 4.21
今天进行了供货商的页面设计,对于需求方发送的商品信息进行数据处理显示需要付款的金额,对补货按钮进行了操作,进行了数据库的更新。
package res; import java.io.IOException; import java.io.PrintWriter; import jakarta.servlet.ServletException; import jakarta.servlet.annotation.WebServlet; import jakarta.servlet.http.HttpServlet; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; @WebServlet("/Sere") public class Serve extends HttpServlet{ Daos d=new Daos(); public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{ String method=request.getParameter("method"); switch (method){ case "bh": //phone=<%=b.getUser_phone()%>&method=bh&sum=<%=b.getTotal()%>&name=<%=b.getName()%> String name=request.getParameter("name"); String mphone=request.getParameter("phone"); String sum=request.getParameter("sum"); String mer=request.getParameter("mer"); String time=request.getParameter("time"); d.buhuo(name,sum,mphone); d.gx(mer, time, mphone, name); response.setContentType("text/html;charset=utf-8"); PrintWriter out = response.getWriter(); out.println("<script language=javascript>alert('补货成功');window.history.go(-1);location.href=document.referrer</script>"); break; case "finds": String numss=request.getParameter("num"); Integer iss=Integer.parseInt(numss)-1; String nums1s=String.valueOf(iss); String price=request.getParameter("price"); Integer pp=Integer.parseInt(price); String date=request.getParameter("date"); String namess=request.getParameter("name"); String tels=request.getParameter("tel"); d.finds(namess, nums1s,tels); d.zds(namess, pp, tels, date); request.getRequestDispatcher("index.jsp").forward(request, response); break; case "find": String nums=request.getParameter("num"); //Integer is=Integer.parseInt(nums)-1; //String nums1=String.valueOf(is); String dates=request.getParameter("date"); String prices=request.getParameter("price"); //Integer pp=Integer.parseInt(price); String names=request.getParameter("name"); String tel=request.getParameter("tel"); request.setAttribute("num", nums); request.setAttribute("name", names); request.setAttribute("tel", tel); request.setAttribute("price", prices); request.setAttribute("date", dates); request.getRequestDispatcher("erweima.jsp").forward(request, response); break; /*case "fi": String numst=request.getParameter("num"); Integer ist=Integer.parseInt(numst); String nums1t=String.valueOf(ist); String datess=request.getParameter("date"); String namest=request.getParameter("name"); String telt=request.getParameter("tel"); d.finds(namest, nums1t,telt); d.del(dates,telt); request.getRequestDispatcher("index.jsp").forward(request, response);*/ } } @Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{ doPost(request,response); } }