• 大小: 15.22MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-07-13
  • 语言: 其他
  • 标签: java  框架  ssh  前台  

资源简介

完整的可运行的框架代码。

资源截图

代码片段和文件信息

package com.qn.user.controller;

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

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.qn.user.model.People;
import com.qn.user.model.Teacher;
import com.qn.user.model.Tip;
import com.qn.user.model.User;
import com.qn.user.service.UserService;

@Controller
@RequestMapping(value=“/user“)
public class UserController {

@Resource
UserService userService;




@RequestMapping(value=“/list“)
public String list(Model model){

/*List users = new ArrayList();
User user1 = new User();
user1.setUsername(“zhangsan“);
user1.setRealname(“张三“);
users.add(user1);
User user2 = new User();
user2.setUsername(“lisi“);
user2.setRealname(“李四“);
users.add(user2);*/

model.addAttribute(“abc“ userService.getUserList());

return “/user/list“;
}

@RequestMapping(value=“/form“)
public String form(Integer idModel model){

User user = new User();

if(id !=null && id>0){
 user = userService.get(id);
}

model.addAttribute(“user“ user);


return “/user/form“;
}


@RequestMapping(value=“/save“)
public String save(User user){
userService.save(user);

return “redirect:/user/list“;
}

@RequestMapping(value=“/delete“)
public String delete(int id){
userService.delete(id);

return “redirect:/user/list“;
}
@RequestMapping(value=“/test“)
@ResponseBody
public User test(){
User u = new User();
u.setUsername(“张三“);
return u;
}

//学生,教师,管理员登录判断
@RequestMapping(value=“/getuser“)
public String getuser(String nameString passwordString t1HttpServletRequest requestHttpServletResponse response){
System.out.println(name+““+password+““+t1);
HttpSession session=request.getSession();
User user=new User();Teacher teacher=new Teacher();People people=new People();
if (t1.equals(“学生“)) {
user=userService.getstu(name);
if(user.getPassword().equals(password)){
session.setAttribute(“name“ user.getUsername());session.setAttribute(“id“ user.getId());
System.out.println(“学生登录成功“);return “redirect:/user/sindex.jsp“;}
else{System.out.println(“denglushibai“);return “redirect:/user/test.jsp“;}
}else if (t1.equals(“教师“)) {
teacher=userService.getTea(name);
if (teacher.getPassword().equals(password)) {
session.setAttribute(“name“ teacher.getTname());session.setAttribute(“id“ teacher.getTid());
System.out.println(“教师登录成功“);return “redirect:/user/tindex.jsp“;}
else{System.out.println(“denglusjibai“);return “redirect:/user/test.jsp“;}

}els

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2016-06-23 11:35  springmvc_spring_mybatis\
     文件         548  2016-05-13 19:44  springmvc_spring_mybatis\.classpath
     文件        1057  2016-02-21 14:09  springmvc_spring_mybatis\.project
     目录           0  2016-06-23 11:35  springmvc_spring_mybatis\.settings\
     文件         503  2016-02-21 14:09  springmvc_spring_mybatis\.settings\.jsdtscope
     文件          75  2016-05-18 17:55  springmvc_spring_mybatis\.settings\org.eclipse.core.resources.prefs
     文件         364  2016-02-21 14:09  springmvc_spring_mybatis\.settings\org.eclipse.jdt.core.prefs
     文件         526  2016-02-21 14:09  springmvc_spring_mybatis\.settings\org.eclipse.wst.common.component
     文件         345  2016-02-21 14:09  springmvc_spring_mybatis\.settings\org.eclipse.wst.common.project.facet.core.xml
     文件          49  2016-02-21 14:09  springmvc_spring_mybatis\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2016-02-21 14:09  springmvc_spring_mybatis\.settings\org.eclipse.wst.jsdt.ui.superType.name
     目录           0  2016-06-23 11:35  springmvc_spring_mybatis\WebContent\
     目录           0  2016-06-23 11:35  springmvc_spring_mybatis\WebContent\meta-INF\
     文件          39  2016-02-21 14:09  springmvc_spring_mybatis\WebContent\meta-INF\MANIFEST.MF
     目录           0  2016-06-23 11:35  springmvc_spring_mybatis\WebContent\WEB-INF\
     目录           0  2016-06-23 11:35  springmvc_spring_mybatis\WebContent\WEB-INF\lib\
     文件        4467  2015-12-17 18:49  springmvc_spring_mybatis\WebContent\WEB-INF\lib\aopalliance-1.0.jar
     文件      119683  2015-12-17 18:49  springmvc_spring_mybatis\WebContent\WEB-INF\lib\aspectjrt-1.7.4.jar
     文件     1850391  2015-12-17 18:49  springmvc_spring_mybatis\WebContent\WEB-INF\lib\aspectjweaver-1.7.4.jar
     文件      160519  2015-12-29 20:12  springmvc_spring_mybatis\WebContent\WEB-INF\lib\commons-dbcp-1.4.jar
     文件       62050  2015-12-16 18:51  springmvc_spring_mybatis\WebContent\WEB-INF\lib\commons-logging-1.1.3.jar
     文件       96221  2015-12-29 20:12  springmvc_spring_mybatis\WebContent\WEB-INF\lib\commons-pool-1.5.4.jar
     文件       16030  2016-02-21 16:11  springmvc_spring_mybatis\WebContent\WEB-INF\lib\geronimo-jta_1.1_spec-1.1.1.jar
     文件      780385  2016-03-16 13:46  springmvc_spring_mybatis\WebContent\WEB-INF\lib\jackson-mapper-asl-1.9.12.jar
     文件      771073  2016-03-16 13:46  springmvc_spring_mybatis\WebContent\WEB-INF\lib\jackson-mapper-lgpl-1.9.2.jar
     文件      414240  2016-02-21 14:41  springmvc_spring_mybatis\WebContent\WEB-INF\lib\jstl-1.2.jar
     文件     1417472  2016-02-21 09:23  springmvc_spring_mybatis\WebContent\WEB-INF\lib\mybatis-3.3.0.jar
     文件       51337  2016-02-21 14:57  springmvc_spring_mybatis\WebContent\WEB-INF\lib\mybatis-spring-1.2.4.jar
     文件      954038  2015-12-01 20:14  springmvc_spring_mybatis\WebContent\WEB-INF\lib\mysql-connector-java-5.1.30.jar
     文件      368915  2016-02-21 14:10  springmvc_spring_mybatis\WebContent\WEB-INF\lib\spring-aop-4.2.3.RELEASE.jar
     文件       58405  2016-02-21 14:10  springmvc_spring_mybatis\WebContent\WEB-INF\lib\spring-aspects-4.2.3.RELEASE.jar
............此处省略474个文件信息

评论

共有 条评论