• 大小: 6.1MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-10-11
  • 语言: Java
  • 标签: js  servlet  

资源简介

一个学生信息管理系统,使用jsp+Servlet的MVC模式,mysql数据库

资源截图

代码片段和文件信息

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 cn.edu.hpu.dao.PageBean;
import cn.edu.hpu.domain.Student;
import cn.edu.hpu.service.StudentService;


public class StudentServlet1 extends HttpServlet {

public void doGet(HttpServletRequest request HttpServletResponse response)
throws ServletException IOException {
doPost(request response);
}

public void doPost(HttpServletRequest request HttpServletResponse response)
throws ServletException IOException {
StudentService studentService = new StudentService();
//获取请求路径
//http://localhost:8080/PageBeanDemon/StudentServlet?null&pc=6
//http://localhost:8080/PageBeanDemon/
//${pageContext.request.contextPath }/StudentServlet?null&pc=${pb.pc -1}
String uri = request.getRequestURI()+“?“+request.getQueryString();
int index=uri.indexOf(“StudentServlet“);
if(index==-1) {
uri=“http://localhost:8080/student/StudentServlet?null“;
}

index = uri.lastIndexOf(“&pc=“);
if(index != -1 ){
uri = uri.substring(0index);
}

//获取当前页页码
int pc = 1;
String param = request.getParameter(“pc“);
if(param != null && !param.trim().isEmpty()){
//将string类型强制转化为Int类型
pc = Integer.parseInt(param);
}
PageBean pageBean = studentService.findByPageBean(pc);
//pageBean.setPc(pc);
pageBean.setUrl(uri);

/*
List list = pageBean.getBeanlist();
1.
for(int i=0; i Student student = list.get(i);
student.getName();
}

2.
for(Student a : list){
a.getName();
}
*/
//将数据放到Request域
request.setAttribute(“pb“ pageBean);
//转发
request.getRequestDispatcher(“s.jsp“).forward(request response);

}

}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       1093  2016-05-06 22:44  student\.classpath

     文件          0  2016-05-04 20:36  student\.metadata\.lock

     文件     161067  2016-05-04 20:37  student\.metadata\.log

    .......      1086  2016-05-04 20:38  student\.metadata\.mylyn\repositories.xml

     文件        438  2016-05-04 20:38  student\.metadata\.mylyn\repositories.xml.zip

     文件        447  2016-05-04 20:37  student\.metadata\.plugins\com.genuitec.eclipse.migration\workspace.properties

     文件        828  2016-05-04 20:37  student\.metadata\.plugins\com.genuitec.eclipse.sqlexplorer\ConnectionProfiles.xml

     文件      16643  2016-05-04 20:37  student\.metadata\.plugins\com.genuitec.eclipse.sqlexplorer\SQLDrivers.xml

     文件        174  2016-05-04 20:37  student\.metadata\.plugins\com.genuitec.pulse.client.delivery.package.runtime\logs\package-runtime-0.log

     文件          0  2016-05-04 20:37  student\.metadata\.plugins\com.genuitec.pulse.client.delivery.package.runtime\logs\package-runtime-0.log.lck

     文件         57  2016-05-04 20:37  student\.metadata\.plugins\org.eclipse.core.resources\.root\.indexes\properties.index

     文件        994  2016-05-04 20:37  student\.metadata\.plugins\org.eclipse.core.runtime\.settings\com.genuitec.eclipse.wizards.prefs

     文件        120  2016-05-04 20:37  student\.metadata\.plugins\org.eclipse.core.runtime\.settings\com.genuitec.pulse.client.delivery.package.runtime.prefs

     文件        364  2016-05-04 20:37  student\.metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.jdt.core.prefs

     文件        489  2016-05-04 20:37  student\.metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.jdt.ui.prefs

     文件         62  2016-05-04 20:36  student\.metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.mylyn.context.core.prefs

     文件         97  2016-05-04 20:36  student\.metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.mylyn.monitor.ui.prefs

     文件        148  2016-05-04 20:37  student\.metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.mylyn.tasks.ui.prefs

     文件        219  2016-05-04 20:37  student\.metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.team.cvs.core.prefs

     文件         67  2016-05-04 20:37  student\.metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.ui.prefs

     文件       3294  2016-05-04 20:37  student\.metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.ui.workbench.prefs

     文件          7  2016-05-04 20:37  student\.metadata\.plugins\org.eclipse.jdt.core\javaLikeNames.txt

     文件        166  2016-05-04 20:37  student\.metadata\.plugins\org.eclipse.jdt.launching\.install.xml

     文件       2375  2016-05-04 20:37  student\.metadata\.plugins\org.eclipse.jdt.launching\libraryInfos.xml

     文件         20  2016-05-04 20:37  student\.metadata\.plugins\org.eclipse.m2e.core\nexus\0330f35fd3dec08cfa47bd61bafc76be\segments.gen

     文件         58  2016-05-04 20:37  student\.metadata\.plugins\org.eclipse.m2e.core\nexus\0330f35fd3dec08cfa47bd61bafc76be\segments_8

     文件          8  2016-05-04 20:37  student\.metadata\.plugins\org.eclipse.m2e.core\nexus\0330f35fd3dec08cfa47bd61bafc76be\timestamp

     文件          0  2016-05-04 20:37  student\.metadata\.plugins\org.eclipse.m2e.core\nexus\0330f35fd3dec08cfa47bd61bafc76be\write.lock

     文件      60917  2016-05-04 20:37  student\.metadata\.plugins\org.eclipse.m2e.core\nexus\0330f35fd3dec08cfa47bd61bafc76be\_7.cfs

     文件         20  2016-05-04 20:37  student\.metadata\.plugins\org.eclipse.m2e.core\nexus\26522e0d83a422eed93329ece7565cfc\segments.gen

............此处省略188个文件信息

评论

共有 条评论