📄 work.java
字号:
package control;
import java.io.*;
import java.sql.*;
import database.sqlBean;
import javax.servlet.*;
import javax.servlet.http.*;
public class work extends HttpServlet {
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
String message = null;
String id = null;
id = req.getParameter("id");
HttpSession session = req.getSession(true);
session.setAttribute("id", String.valueOf(id));
String workplace = null;
workplace = req.getParameter("workplace");
sqlBean db = new sqlBean();
String sql = "update stu set workplace='"+workplace+"'";
db.executeUpdate(sql);
RequestDispatcher rd = getServletContext().getRequestDispatcher(
"/updateWorkPlace.jsp");
rd.forward(req, res);
}
public void doError(HttpServletRequest req, HttpServletResponse res,
String str) throws ServletException, IOException {
req.setAttribute("problem", str);
RequestDispatcher rd = getServletContext().getRequestDispatcher(
"/errorpage.jsp");
rd.forward(req, res);
}
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
doGet(req, res);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -