package com.app.web;
import java.io.IOException;
import java.io.PrintWriter;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.app.entity.Student;
import com.app.service.StudentManager;
@Controller
public class StudentController {
@Resource(name="studentManager")
private StudentManager studentManager;
@RequestMapping("/allStudent")
public String getAllUser(String page,HttpServletRequest request){
if(page ==null){
page = 1+"";
}
request.setAttribute("page", page);
request.setAttribute("pageNum",studentManager.getPageNum());
request.setAttribute("studentList", studentManager.allStudent(page));
return "/allStudent";
}
@RequestMapping("/delStudent")
public void delStudent(String id,HttpServletResponse response){
String result = "{\"result\":\"error\"}";
if(studentManager.deleteStudent(id)){
result = "{\"result\":\"success\"}";
}
response.setContentType("application/json");
try {
PrintWriter out = response.getWriter();
out.write(result);
} catch (IOException e) {
e.printStackTrace();
}
}
@RequestMapping("/toAddStudent")
public String getAddStudentPage(){
return "/addStudent";
}
@RequestMapping("/addStudent")
public String addStudent(Student student,HttpServletRequest request) throws Exception{
if(student.getId()!="" && student.getId() !=null){
studentManager.updateStudent(student);
}
else{
studentManager.addStudent(student);
}
return "redirect:/allStudent";
}
@RequestMapping("/editStudent")
public String editStudent(String id,HttpServletRequest request){
Student student = studentManager.findById(id);
request.setAttribute("student", student);
return "/editStudent";
}
@RequestMapping("/toQueryStudent")
public String getQueryStudent(){
return "/queryStudent";
}
@RequestMapping("/queryStudent")
public String queryStudent(Student student,HttpServletRequest request){
request.setAttribute("studentList", studentManager.queryStudent(student));
return "/queryResult";
}
@RequestMapping("/nextPage")
public String nextPage(String page,HttpServletRequest request){
int curPage = Integer.parseInt(page);
request.setAttribute("page", curPage+1);
request.setAttribute("pageNum",studentManager.getPageNum());
request.setAttribute("studentList", studentManager.allStudent(curPage+1+""));
return "/allStudent";
}
@RequestMapping("/prevPage")
public String prevPage(String page,HttpServletRequest request){
int curPage = Integer.parseInt(page);
request.setAttribute("page", curPage-1);
request.setAttribute("pageNum",studentManager.getPageNum());
request.setAttribute("studentList", studentManager.allStudent(curPage-1+""));
return "/allStudent";
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
student.zip (72个子文件)
student
.settings
org.eclipse.wst.jsdt.ui.superType.name 6B
org.eclipse.wst.jsdt.ui.superType.container 49B
.jsdtscope 500B
org.eclipse.jdt.core.prefs 629B
src
config
springAnnotation-servlet.xml 1KB
springAnnotation-hibernate.xml 2KB
springAnnotation-core.xml 931B
com
app
dao
StudentDAO.java 416B
StudentDAOimpl.java 3KB
web
StudentController.java 3KB
service
StudentManager.java 428B
StudentManagerImpl.java 1KB
entity
Student.java 1KB
.project 1KB
WebRoot
editStudent.jsp 2KB
queryStudent.jsp 1KB
META-INF
MANIFEST.MF 36B
allStudent.jsp 2KB
WEB-INF
web.xml 2KB
classes
config
springAnnotation-servlet.xml 1KB
springAnnotation-hibernate.xml 2KB
springAnnotation-core.xml 931B
com
app
dao
StudentDAOimpl.class 4KB
StudentDAO.class 651B
web
StudentController.class 4KB
service
StudentManager.class 663B
StudentManagerImpl.class 2KB
entity
Student.class 2KB
lib
spring-webmvc-portlet-4.0.6.RELEASE.jar 172KB
jboss-transaction-api_1.1_spec-1.0.0.Final.jar 11KB
sqljdbc.jar 570KB
dom4j-1.6.1.jar 307KB
mysql-connector-java-5.1.7-bin.jar 693KB
spring-beans-4.0.6.RELEASE.jar 655KB
spring-core-4.0.6.RELEASE.jar 954KB
spring-jms-4.0.6.RELEASE.jar 206KB
antlr-2.7.7.jar 435KB
spring-tx-4.0.6.RELEASE.jar 243KB
spring-context-4.0.6.RELEASE.jar 955KB
spring-instrument-tomcat-4.0.6.RELEASE.jar 10KB
ojdbc14.jar 1.47MB
hibernate-core-4.1.6.Final.jar 4.25MB
spring-expression-4.0.6.RELEASE.jar 201KB
jboss-logging-3.1.0.GA.jar 59KB
spring-build-src-4.0.6.RELEASE.jar 71KB
spring-instrument-4.0.6.RELEASE.jar 7KB
spring-jdbc-4.0.6.RELEASE.jar 415KB
spring-websocket-4.0.6.RELEASE.jar 274KB
spring-webmvc-4.0.6.RELEASE.jar 647KB
spring-context-support-4.0.6.RELEASE.jar 132KB
spring-test-4.0.6.RELEASE.jar 439KB
spring-web-4.0.6.RELEASE.jar 657KB
spring-messaging-4.0.6.RELEASE.jar 262KB
spring-orm-4.0.6.RELEASE.jar 359KB
jstl.jar 17KB
spring-framework-bom-4.0.6.RELEASE.jar 6KB
commons-logging.jar 59KB
aopalliance.jar 4KB
hibernate-jpa-2.0-api-1.0.1.Final.jar 100KB
spring-oxm-4.0.6.RELEASE.jar 79KB
com.springsource.org.apache.commons.io-1.4.0.jar 108KB
hibernate-commons-annotations-4.0.1.Final.jar 79KB
com.springsource.org.apache.commons.fileupload-1.2.0.jar 53KB
spring-aspects-4.0.6.RELEASE.jar 51KB
javassist-3.15.0-GA.jar 633KB
spring-aop-4.0.6.RELEASE.jar 345KB
queryResult.jsp 2KB
js
jquery-1.9.1.min.js 90KB
index.jsp 834B
addStudent.jsp 2KB
.mymetadata 294B
.classpath 4KB
.myeclipse
共 72 条
- 1
资源评论
- u0133067502016-08-18没数据库文件
- liupeng8262016-02-26haibucuo 还不错的
zwbonline1112
- 粉丝: 7
- 资源: 11
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 以下是一些大数据面试习题.pdf
- 3414-CMN3414-VB一款SOT23封装N-Channel场效应MOS管
- ASTM G154-2023 Practice for Operating Fluorescent Ultraviolet UV
- 小米智能摄像机 云台版2K 固件
- 340G-VB一款N-Channel沟道SOT23的MOSFET晶体管参数介绍与应用说明
- 3407-VB一款P-Channel沟道SOT23的MOSFET晶体管参数介绍与应用说明
- 在职证明.pdf
- PrimePower User Guide Version T-2022.03, March 2022.pdf
- 以下是一个简单的PyTorch项目示例,用于构建和训练一个基本的神经网络模型进行手写数字识别.pdf
- JAVA真实包装项目经验-在线教育项目面试
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功