📄 toubiaocheck.java
字号:
package C03.Servlet;
import java.io.IOException;
import java.util.Vector;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import C03.BO.*;
import C03.VO.*;
public class toubiaoCheck extends HttpServlet {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* Constructor of the object.
*/
public toubiaoCheck() {
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 {
String action = request.getParameter("action");
String tb_id = request.getParameter("tb_id");
if(action.equals("jiena")){
toubiaoBO tb = new toubiaoBO();
String project_id=tb.returnproject(tb_id);
if( tb.updatatoubiao(tb_id)){
response.sendRedirect("../looktbuser.jsp?action="+project_id+"");
}
}
if(action.equals("del")){
toubiaoBO tb = new toubiaoBO();
UserBO ub = new UserBO();
String project_id=tb.returnproject(tb_id);
String user=tb.returnusername(tb_id);
String maker_id = ub.reutrnmaker_id(user);
productBO pb = new productBO();
if(pb.delproject_product(project_id, maker_id))
{
if(tb.deltoubiao(tb_id)){
response.sendRedirect("../looktbuser.jsp?action="+project_id+"");
}
}else
{if(tb.deltoubiao(tb_id)){
response.sendRedirect("../looktbuser.jsp?action="+project_id+"");
}
}
}
}
/**
* 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 {
toubiaoBO TB = new toubiaoBO();
String user_NAME = (String) request.getSession().getAttribute(
"username");
String project_ID = request.getParameter("xmID").trim();
String tb_cost = request.getParameter("tb_cost").trim();
String tb_content = request.getParameter("tb_content").trim();
String projectsum = request.getParameter("productsum").trim();
String rodio = request.getParameter("rodio").trim();
Vector vc=null;
Vector vc1 = null;
Vector vc2 = null;
if(TB.fildprojectuser(project_ID, user_NAME)!=true)
{
if (TB.fildtoubiao(user_NAME, project_ID) != true) {
if (TB.toubiao(project_ID, user_NAME,tb_cost,tb_content)){
if(rodio.equals("2")){
userBean bean =new UserBO().returnuser(user_NAME);
String maker_id = bean.getMaker_id();
int sum = Integer.parseInt(projectsum);
vc = new Vector();
vc1 = new Vector();
vc2= new Vector();
for(int i=1;i<sum;i++){
vc.addElement((String)request.getParameter("productname"+i+"").trim());
vc1.addElement((String)request.getParameter("productprice"+i+"").trim());
vc2.addElement((String)request.getParameter("project_content"+i+"").trim());
}
productBO bo = new productBO();
if(bo.insettbproduct(vc, project_ID, vc1, vc2, maker_id)){
response.sendRedirect("../toubiaoinput.jsp?xinxi=pass");
}
}else{
response.sendRedirect("../toubiaoinput.jsp?xinxi=pass");
}
} else
response.sendRedirect("../toubiaoinput.jsp?xinxi=error");
} else
response.sendRedirect("../toubiaoinput.jsp?xinxi=CF");
}else response.sendRedirect("../toubiaoinput.jsp?xinxi=erroruser");
}
/**
* Initialization of the servlet. <br>
*
* @throws ServletException
* if an error occure
*/
public void init() throws ServletException {
// Put your code here
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -