• 大小: 36KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-05-13
  • 语言: 数据库
  • 标签: SSM  

资源简介

弄了好些天,怪不容易的,给个分意思意思吧

资源截图

代码片段和文件信息

package com.cn.uuu.controller;



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

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import com.cn.uuu.pojo.User1;
import com.cn.uuu.service.UserService;



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

@Resource(name=“userServiceImpl“)
private UserService userService;

public UserService getUserService() {
return userService;
}

public void setUserService(UserService userService) {
this.userService = userService;
}


@RequestMapping(value=“/showuser.do“ method = RequestMethod.POST)
public String toIndex(HttpServletRequest requestModel model){
User1 userLogin=new User1();
userLogin.setUsername(request.getParameter(“username“));
userLogin.setPassword(request.getParameter(“password“));

 User1 user=new User1();

if(this.userService.getLoginUser(userLogin)){
          user=this.userService.getUserByusername(userLogin.getUsername());
          System.out.println(user.toString()+“get user success“);
          model.addAttribute(“user“ user);
       
}else{
model.addAttribute(“user can not in use“);
System.out.println(“can not get user“);
}
       return “indexuser“;
}



@RequestMapping(value=“/register.do“method= RequestMethod.POST)
public String registerIndex(HttpServletRequest requestModel model){

//ModelAndView mav=new ModelAndView();

User1 userRegister=new User1();
String username2=request.getParameter(“username“);
String password2=request.getParameter(“password“);
userRegister.setUsername(username2);
userRegister.setPassword(password2);
System.out.println(username2+“蟇�遐∵弍“+password2);

if(userRegister.getUsername()!=null){
if (request.getParameter(“age“)==null) {
userRegister.setAge(25);
}else{
userRegister.setAge(Integer.parseInt(request.getParameter(“age“)));
}
System.out.println(userRegister.getUsername()+“ 譏セ遉コ豕ィ蜀檎噪蜷榊ュ�“);

}else{

User1 user2 = new User1();  
user2.setUsername(“pm“);  
user2.setPassword(“pm“);  
user2.setAge(45);  
userRegister=user2;
}

int id=this.userService.inster(userRegister);

        User1 user=this.userService.getUserById(id);
        
        System.out.println(user.toString()+“insert user success“);
        
        model.addAttribute(“user“ user);

    return “indexuser“;
}






}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件        1306  2017-02-08 08:06  .classpath
     文件        1211  2017-02-06 11:12  .project
     目录           0  2017-02-07 14:12  .settings\
     文件         575  2015-01-16 09:58  .settings\.jsdtscope
     文件         252  2017-02-08 08:12  .settings\org.eclipse.core.resources.prefs
     文件         430  2015-01-16 09:58  .settings\org.eclipse.jdt.core.prefs
     文件          90  2015-01-16 09:58  .settings\org.eclipse.m2e.core.prefs
     文件         731  2015-01-16 10:00  .settings\org.eclipse.wst.common.component
     文件         252  2015-01-16 09:58  .settings\org.eclipse.wst.common.project.facet.core.xml
     文件          49  2015-01-16 09:58  .settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2015-01-16 09:58  .settings\org.eclipse.wst.jsdt.ui.superType.name
     文件          50  2015-01-16 09:58  .settings\org.eclipse.wst.validation.prefs
     目录           0  2017-02-07 14:12  logs\
     文件           0  2015-01-16 16:11  logs\ssm.log
     文件        5158  2017-02-08 08:00  pom.xml
     目录           0  2017-02-07 14:12  src\
     目录           0  2017-02-07 14:12  src\main\
     目录           0  2017-02-07 14:12  src\main\java\
     目录           0  2017-02-07 14:12  src\main\java\com\
     目录           0  2017-02-07 14:12  src\main\java\com\cn\
     目录           0  2017-02-07 14:12  src\main\java\com\cn\uuu\
     目录           0  2017-02-07 14:12  src\main\java\com\cn\uuu\controller\
     文件        2832  2017-02-08 08:12  src\main\java\com\cn\uuu\controller\UserController.java
     目录           0  2017-02-07 14:12  src\main\java\com\cn\uuu\IDao\
     文件         430  2017-01-18 09:57  src\main\java\com\cn\uuu\IDao\UserMapper.java
     目录           0  2017-02-07 14:12  src\main\java\com\cn\uuu\mapping\
     文件        3192  2017-02-08 08:08  src\main\java\com\cn\uuu\mapping\UserMapper.xml
     目录           0  2017-02-07 14:12  src\main\java\com\cn\uuu\pojo\
     文件         820  2017-01-18 09:57  src\main\java\com\cn\uuu\pojo\User1.java
     目录           0  2017-02-07 14:12  src\main\java\com\cn\uuu\service\
     目录           0  2017-02-07 14:12  src\main\java\com\cn\uuu\service\impl\
............此处省略58个文件信息

评论

共有 条评论