团队作业(五):冲刺总结(七)

团队作业(五):冲刺总结(七)

项目:电子公文传输系统

今日任务

  • 后端设计处理PasswordController.java LeaderController.java
  • 后端设计处理RemoveController.java DepartmentController.java
  • 前端设计systemuser.jsp
  • 数据库代码处理 SQLConnection.java
  • 前端设计left.jsp

今日任务的完成情况

学号&姓名 任务 完成情况
20191304商苏赫 后端设计处理PasswordController.java LeaderController.java 100%
20191314徐汇仁 后端设计处理RemoveController.java DepartmentController.java 100%
20191323王予涵 前端设计systemuser.jsp 100%
20191325施羿 数据库代码处理 SQLConnection.java 100%
20191330雷清逸 前端设计left.jsp 100%

任务片段

PasswordController
package controller;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;

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 pojo.CRUDHelper;

public class PasswordController extends HttpServlet {

	/**
	 * Constructor of the object.
	 */
	public PasswordController() {
		super();
	}

	/**
	 * Destruction of the servlet. <br>
	 */
	@Override
	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
	 */
	@Override
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doPost(request, response);
	}

	/**
	 * 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
	 */
	@Override
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		
		response.setContentType("text/html;charset=gb2312");
		request.setCharacterEncoding("gb2312");
		
		String newpwd = request.getParameter("newpwd");
		HttpSession session = request.getSession();
		
		ArrayList adminlogin = (ArrayList)session.getAttribute("adminlogin");
		
		String sql = "update admin set pwd='"+newpwd+"' where id="+adminlogin.get(0);
		CRUDHelper ib = new CRUDHelper();
		int responseText = ib.insertANDupdateANDdel(sql);
		
		PrintWriter out = response.getWriter();
		out.print(responseText);
		out.close();
	}

	/**
	 * Initialization of the servlet. <br>
	 *
	 * @throws ServletException if an error occure
	 */
	@Override
	public void init() throws ServletException {
		// Put your code here
	}

}

RemoveController.java
package controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

public class RemoveController extends HttpServlet {

	/**
	 * Constructor of the object.
	 */
	public RemoveController() {
		super();
	}

	/**
	 * Destruction of the servlet. <br>
	 */
	@Override
	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
	 */
	@Override
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doPost(request, response);
	}

	/**
	 * 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
	 */
	@Override
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		
		response.setContentType("text/html;charset=gb2312");
		request.setCharacterEncoding("gb2312");

		String mark = request.getParameter("mark");
		String responseText = "";
		
		HttpSession session = request.getSession();
		
		//if(mark != null && mark.equals("users")){
			session.removeAttribute("userslogin");
		//}
		//if(mark != null && mark.equals("admin")){
			session.removeAttribute("adminlogin");
		//}
		responseText = mark;
		PrintWriter out = response.getWriter();
		out.print(responseText);
		out.close();

		request.getRequestDispatcher("/admin/index.jsp").forward(request, response);
	}

	/**
	 * Initialization of the servlet. <br>
	 *
	 * @throws ServletException if an error occure
	 */
	@Override
	public void init() throws ServletException {
		// Put your code here
	}

}

SQLConnection.java
package controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

public class RemoveController extends HttpServlet {

	/**
	 * Constructor of the object.
	 */
	public RemoveController() {
		super();
	}

	/**
	 * Destruction of the servlet. <br>
	 */
	@Override
	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
	 */
	@Override
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doPost(request, response);
	}

	/**
	 * 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
	 */
	@Override
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		
		response.setContentType("text/html;charset=gb2312");
		request.setCharacterEncoding("gb2312");

		String mark = request.getParameter("mark");
		String responseText = "";
		
		HttpSession session = request.getSession();
		
		//if(mark != null && mark.equals("users")){
			session.removeAttribute("userslogin");
		//}
		//if(mark != null && mark.equals("admin")){
			session.removeAttribute("adminlogin");
		//}
		responseText = mark;
		PrintWriter out = response.getWriter();
		out.print(responseText);
		out.close();

		request.getRequestDispatcher("/admin/index.jsp").forward(request, response);
	}

	/**
	 * Initialization of the servlet. <br>
	 *
	 * @throws ServletException if an error occure
	 */
	@Override
	public void init() throws ServletException {
		// Put your code here
	}

}

项目实际运行截图












会议合照

image

燃尽图

posted @ 2021-12-11 23:40  1913新生代农民工  阅读(67)  评论(0编辑  收藏  举报