任务7:结合JDBC和Servlet实现员工管理系统后台的部分功能。
9
李焕贞
开始于 2021-06-08 11:12
0 6 94
已截止

任务尚未发布或者你没有权限查看任务内容。

任务讨论

老师,我交错了一个类。。。。

package homework07.servlet;

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

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import Service.EmDemo1;
import Service.MmDemo1;
import Service.PmDemo1;
import homework07.demo.Em;
import homework07.demo.Mm;
import homework07.demo.Pm;

/**
 * Servlet implementation class eidt
 */
@WebServlet("/job/edit")
public class Reidt extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public Reidt() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		//完成数据修改;
		//创
		request.setCharacterEncoding("utf-8");
		response.setContentType("text/html;charset=utf-8");
		List<Mm>list=new MmDemo1().addList();
		List<Pm> list1=new PmDemo1().addList();
		List<Em> list2=new EmDemo1().addList();
		PrintWriter writer=response.getWriter();
		writer.write("<!DOCTYPE html><html>"+"<head>"+ "<meta charset=\"UTF-8\">"+"<title>Insert title here</title>"+"</head>"+"<body>");		
		writer.write("<form action ='eidt' >");
		writer.write("职位:"+"</br>");
		writer.write("<select name='ePost'>");
		for(Pm m:list1) {
			writer.write("<option>"+m.getPost()+"</option>");
		}
		writer.write("</select>"+"</br>");
		writer.write("薪资水平"+"</br>");
		writer.write("<select name='mLevel'>");
		for(Mm m:list) {
			writer.write("<option>"+m.getLevel()+"</option>");
		}
		writer.write("</select>"+"</br>");
		writer.write("姓名:"+"</br>");
		writer.write("<select name='eName'>");
		for(Em m:list2) {
			writer.write("<option>"+m.getName()+"</option>");
		}
		writer.write("</select>"+"</br>");
		writer.write("<input type='submit' value='保存'>");
		writer.write("</form>");
		writer.write("</body></html>");
		

	}/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}