通用分页下

通用分页下

接下来要做的就是把文件写到action里面

查询所有的StudentServletDetalis里面去

配置的话直接在上面@WebServlet("/StudentServletDetails")
快捷简便

package com.zhuchenxi.action;

import java.io.IOException;
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 com.zhuchenxi.dao.StudentDao;
import com.zhuchenxi.entity.Student;

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

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

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		String id=request.getParameter("id");
		List list = studentDao.list(id);
		request.setAttribute("list", list);
		request.getRequestDispatcher("details.jsp").forward(request, response);
	}

}

接下来是index.jsp界面的东西

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>




Insert title here


	
		
	
	
公司名称:
编号 类型 公司名称 公司地址 工资 网址 学历要求 时间 操作
${i.id } ${i.job } ${i.company } ${i.address } ${i.salary } ${i.url } ${i.limit } ${i.time } 删除 修改 查看详情
当前第${pageBean.page }页 共${pageBean.maxPage }页 共${pageBean.total } 首页 上一页 下一页 尾页

其中还有增加修改的界面就不放出来了

效果图:
通用分页下_第1张图片

下一页的
通用分页下_第2张图片

你可能感兴趣的:(MVC复习)