web.xml

applicationContext.xml

springmvc-servlet.xml

UserController

  1. package com.ssi.controller;
  2.  
  3. import org.springframework.beans.factory.annotation.Autowired;
  4. import org.springframework.stereotype.Controller;
  5. import org.springframework.web.bind.annotation.RequestMapping;
  6. import org.springframework.web.bind.annotation.RequestParam;
  7.  
  8. import com.ssi.entity.User;
  9. import com.ssi.service.UserService;
  10.  
  11. @Controller
  12. public class UserController {
  13. @Autowired
  14. private UserService userService;
  15. @RequestMapping("/login")
  16. public String login(String username,String password){
  17.  
  18. boolean isLogin = userService.isLogin(username, password);
  19. if(isLogin){
  20. return "redirect:/getList.do";
  21. }else{
  22. return "login";
  23. }
  24. }
  25.  
  26. }

  

EmpController

  1. package com.ssi.controller;
  2.  
  3. import java.util.List;
  4.  
  5. import org.springframework.beans.factory.annotation.Autowired;
  6. import org.springframework.stereotype.Controller;
  7. import org.springframework.web.bind.annotation.RequestMapping;
  8. import org.springframework.web.servlet.ModelAndView;
  9.  
  10. import com.ssi.entity.Emp;
  11. import com.ssi.service.EmpService;
  12.  
  13. @Controller
  14. public class EmpController {
  15. @Autowired
  16. private EmpService empService;
  17. @RequestMapping("/getList")
  18. public ModelAndView getEmplist(){
  19. List<Emp>list = empService.getEmpList();
  20. /* 这个写法 和下面是一样的 不过这个你可以传递多个参数到list.jsp页面
  21. * ModelAndView mv =new ModelAndView();
  22. mv.setViewName("list");
  23. mv.addObject("list", list);
  24. return mv;
  25. */
  26. return new ModelAndView("list", "list", list);
  27. }
  28. }

  list.jsp

  1. <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
  2. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
  3. <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
  4.  
  5. <%
  6. String path = request.getContextPath();
  7. String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
  8. %>
  9.  
  10. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  11. <html>
  12. <head>
  13. <base href="<%=basePath%>">
  14.  
  15. <title>My JSP 'list.jsp' starting page</title>
  16.  
  17. <meta http-equiv="pragma" content="no-cache">
  18. <meta http-equiv="cache-control" content="no-cache">
  19. <meta http-equiv="expires" content="0">
  20. <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
  21. <meta http-equiv="description" content="This is my page">
  22. <!--
  23. <link rel="stylesheet" type="text/css" href="styles.css">
  24. -->
  25.  
  26. </head>
  27.  
  28. <body>
  29.  
  30. <table border="1px" cellpadding="3" cellspacing="2">
  31. <thead>
  32. <tr>
  33. <td>雇员编号</td>
  34. <td>姓名</td>
  35. <td>工作</td>
  36. <td>经理编号</td>
  37. <td>入职日期</td>
  38. <td>薪资</td>
  39. <td>津贴</td>
  40. <td>部门编号</td>
  41. </tr>
  42. </thead>
  43. <tbody>
  44. <c:forEach items="${list}" var="emp">
  45. <tr>
  46. <td>${emp.empno}</td>
  47. <td>${emp.ename}</td>
  48. <td>${emp.job}</td>
  49. <td>${emp.mgr}</td>
  50. <td><fmt:formatDate value="${emp.hiredate}" pattern="yyyy-MM-dd"/></td>
  51. <td>${emp.sal}</td>
  52. <td>${emp.deptno}</td>
  53. <td><a href="getEmp.action?empno=${emp.empno}&flag=4">修改</a>   
  54. <a href="delEmp.action?flag=3&empno=${emp.empno}">删除</a>
  55. </td>
  56. </tr>
  57. </c:forEach>
  58. </tbody>
  59. </table>
  60. </body>
  61. </html>

 引入类库 fmt标签

 

引入fmt标签

JAVAWEB 一一框架整合(SSI : Spring+SpringMVC+ ibtis)的更多相关文章

  1. SSM框架整合(Spring+SpringMVC+MyBatis+Oracle)

    1.开发环境搭建以及创建Maven Web项目 参看之前的博文[确保maven web项目不报错]:http://www.cnblogs.com/cainiaomahua/p/6306476.html ...

  2. 04_SSM框架整合(Spring+SpringMVC+MyBatis)

    [SSM的系统架构] [整合概述] 第一步: MyBatis和Spring整合,通过Spring管理mapper接口. 使用mapper的扫描器自动扫描mapper接口在Spring中进行注册. 第二 ...

  3. JAVAWEB 一一 框架整合(SSH,Spring+Struts2+Hibernate IOC/DI AOP声明式事务处理 定时任务)

    package org.springframework.orm.hibernate3; import java.io.Serializable; import java.util.List; impo ...

  4. SSM框架整合(Spring + SpringMVC + MyBatis)

    搭建环境 使用Spring(业务层)整合其他的框架SpringMVC(表现层)和MyBatis(持久层) Spring框架 创建数据库表 CREATE DATABASE ssm; USE ssm; C ...

  5. SSM三大框架整合(Spring+SpringMVC+MyBatis)

    一. 导包 18个必须的包 二.配置Spring MVC的web文件 <?xml version="1.0" encoding="UTF-8"?> ...

  6. SSM框架整合(注解)-Spring+SpringMVC+MyBatis+MySql

    准备工作: 下载整合所需的jar包 点击此处下载 使用MyBatis Generator生成dao接口.映射文件和实体类 如何生成 搭建过程: 先来看一下项目的 目录结构 1.配置dispatcher ...

  7. SSM简明教程:简单的十步教你搭建人生第一个SSM框架[ SSM框架整合教程(Spring+SpringMVC+MyBatis) ]

    SSM_BookSystem SSM框架基础 SSM_BookSystem ---> Hello CRUD 说明:本项目目前包含基础的CRUD 日期:2017-05-01 22:25:37 作者 ...

  8. RabbitMQ与Spring的框架整合之Spring Boot实战

    1.RabbitMQ与Spring的框架整合之Spring Boot实战. 首先创建maven项目的RabbitMQ的消息生产者rabbitmq-springboot-provider项目,配置pom ...

  9. SSM框架整合( Spring 、 SpringMVC 和 Mybatis )

    1.基本概念 1.1.Spring Spring 是一个开源框架, Spring 是于 2003  年兴起的一个轻量级的 Java  开发框架,由 Rod Johnson  在其著作 Expert O ...

随机推荐

  1. cordova 常用操作

    #创建插件 plugman create --name MyMath --plugin_id SimpleMath --plugin_version #进入插件目录 cd MyMath #plugin ...

  2. (转)SQL知识_SqlParameter数组

    原文地址:http://www.cnblogs.com/FredTang/archive/2012/03/29/2423651.html 温故而知新,做做笔记先.        SqlParamete ...

  3. winfrom 窗体控件实现二级联动

    ComboBox绑定数据源时触发SelectedIndexChanged事件的处理办法 事件,而这个时候用户并没有选择内容,其SelectedValue也不是对应字段的值.那么时写在SelectedI ...

  4. tp3.2sql改变时间格式

    tp3.2sql改变时间格式2018-05-10取05-10 $listIn=D('api_article as a')->field('date_format( fabutime,\'%m-% ...

  5. 【LeetCode】4. 寻找两个有序数组的中位数

    给定两个大小为 m 和 n 的有序数组 nums1 和 nums2. 请你找出这两个有序数组的中位数,并且要求算法的时间复杂度为 O(log(m + n)). 你可以假设 nums1 和 nums2  ...

  6. 运行vbs脚本

    VBS是基于Visual Basic的脚本语言. VBS的全称是:Microsoft Visual Basic Script Edition.(微软公司可视化BASIC脚本版). 其语言类似Visua ...

  7. ios的input的输入框,readonly的时候,会弹出一小块ios的软键盘

    找了半天方法,结果input直接加个方法就好了 onfocus="this.blur()"

  8. Install Python on Mac (Anaconda)

    Install Python on Mac (Anaconda) 标签(空格分隔): 运维 This blog is copy from the link: https://medium.com/@G ...

  9. 28.Mongodb问题解决

    mongodb问题配置解决: 之前官网下载msi文件安装总是出现问题,这次使用zip压缩包直接解压使用(较为省力). 链接:https://pan.baidu.com/s/1G-jh7CXD1gCz8 ...

  10. Python学习笔记_week3_函数

    一.介绍 1.面向对象(华山派)--->类(独门秘籍)--->class(定义的关键字) 2.面向过程(少林派)--->过程--->def 3.函数式编程(逍遥派)---> ...