mybatis+spring3 mvc 登陆

  • v1_317233
    了解作者
  • 9.4MB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-05-20 05:22
    上传日期
mybatis+spring3 mvc 框架开发的登陆以及增删该查详情。
smvc.zip
内容介绍
package com.bky.controller; import java.util.List; import java.util.UUID; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import com.bky.model.Add; import com.bky.service.BaseService; @Controller public class BaseController { private BaseService baseService; public BaseService getBaseService() { return baseService; } @Autowired public void setBaseService(BaseService baseService) { this.baseService = baseService; } @RequestMapping("login") public String login(Add add,HttpServletRequest req,HttpServletResponse res){ String name=req.getParameter("username"); String pwd=req.getParameter("pwd"); add.setTname(name); add.setTpwd(pwd); req.setAttribute("add", add); System.out.print("用户名:"+add.getTname()+"密码:"+add.getTpwd()); int usize=baseService.to_login(add); //System.out.print(usize); if(usize>0){ return "index"; } return "error"; } @SuppressWarnings("finally") @RequestMapping("addInfo") public String add(Add add,HttpServletRequest request){ try { add.setId(UUID.randomUUID().toString()); System.out.println(add.getId() + ":::::" + add.getTname() + ":::::" + add.getTpwd()); String str = baseService.addInfo(add); System.out.println(str); request.setAttribute("InfoMessage", str); } catch (Exception e) { e.printStackTrace(); request.setAttribute("InfoMessage", "娣诲姞淇℃伅澶辫触锛佸叿浣撳紓甯镐俊鎭細" + e.getMessage()); } finally { return "result"; } } @RequestMapping("getAll") public String getAddInfoAll(HttpServletRequest request){ try { List<add rel='nofollow' onclick='return false;'> list = baseService.getAll(); System.out.println(list); request.setAttribute("addLists", list); return "listAll"; } catch (Exception e) { e.printStackTrace(); request.setAttribute("InfoMessage", "淇℃伅杞藉叆澶辫触锛佸叿浣撳紓甯镐俊鎭細" + e.getMessage()); return "result"; } } @SuppressWarnings("finally") @RequestMapping("del") public String del(String tid,HttpServletRequest request){ try { String str = baseService.delete(tid); request.setAttribute("InfoMessage", str); } catch (Exception e) { e.printStackTrace(); request.setAttribute("InfoMessage", "鍒犻櫎淇℃伅澶辫触锛佸叿浣撳紓甯镐俊鎭細" + e.getMessage()); } finally { return "send"; } } @RequestMapping("modify") public String modify(String tid,HttpServletRequest request){ try { Add add = baseService.findById(tid); request.setAttribute("add", add); return "modify"; } catch (Exception e) { e.printStackTrace(); request.setAttribute("InfoMessage", "淇℃伅杞藉叆澶辫触锛佸叿浣撳紓甯镐俊鎭細" + e.getMessage()); return "result"; } } @SuppressWarnings("finally") @RequestMapping("update") public String update(Add add,HttpServletRequest request){ try { String str = baseService.update(add); request.setAttribute("InfoMessage", str); } catch (Exception e) { e.printStackTrace(); request.setAttribute("InfoMessage", "鏇存柊淇℃伅澶辫触锛佸叿浣撳紓甯镐俊鎭細" + e.getMessage()); } finally { return "result"; } } }
评论
    相关推荐
    • spring mvc
      spring mvc简单实例
    • spring mvc
      spring mvc
    • Spring MVC
      Spring MVC使用注解配置。。。。。。。。。。。。。。。。。。。。。
    • spring mvc
      本代码是spring mvc的一个小demo 只是完成mvc的一个实例。没有复杂的业务逻辑 本demo只是适合刚学习Spring mvc的同行
    • spring mvc
      spring mvc spring mvcspring mvc
    • Spring MVC
      一个简单的spring mvc登录案例,采用的是annotation方式。
    • spring mvc
      spring mvc框架代码实例,测试可用。
    • spring mvc
      spring mvc 开发所需要的全部工具、jar包
    • spring mvc
      这是一个spring mvc3.04例子。这个例子简单,弹性好,易于扩展。好理解。是我在开发时项目例子。
    • spring mvc
      spring mvc最小代码。spring mvc最小代码。spring mvc最小代码。spring mvc最小代码。