Servlet(增删改查)
准备:1.新建一个web项目(StudentZSGC)
2.分层,分包
一.查(查询学员信息
表
关于同志近三年现实表现材料材料类招标技术评分表图表与交易pdf视力表打印pdf用图表说话 pdf
)
(1)新建一个JSP页面(通过form表单进一个servlet(StudentAction))
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServername()+":"+request.getServerPort()+path+"/";
%>
查询学员表
(2)通过web.xml(中转站)找到对应的servlet(StudentAction)
(3)进入action层
package com.student.action;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.student.service.StudentService;
public class StudentAction extends HttpServlet {
/**
* 查询所有人员
*/
private static final long serialVersionUID = 1L;
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
//转码
req.setCharacterEncoding("utf-8");
resp.setCharacterEncoding("utf-8");
resp.setContentType("text/html; charset=utf-8");
//调方法
StudentService studentService=new StudentService();
List