work.java

来自「一个学生课绩管理系统」· Java 代码 · 共 44 行

JAVA
44
字号
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 + =
减小字号Ctrl + -
显示快捷键?