web.xml

applicationContext.xml

springmvc-servlet.xml

UserController

package com.ssi.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import com.ssi.entity.User;
import com.ssi.service.UserService; @Controller
public class UserController {
@Autowired
private UserService userService;
@RequestMapping("/login")
public String login(String username,String password){ boolean isLogin = userService.isLogin(username, password);
if(isLogin){
return "redirect:/getList.do";
}else{
return "login";
}
} }

  

EmpController

package com.ssi.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView; import com.ssi.entity.Emp;
import com.ssi.service.EmpService; @Controller
public class EmpController {
@Autowired
private EmpService empService;
@RequestMapping("/getList")
public ModelAndView getEmplist(){
List<Emp>list = empService.getEmpList();
/* 这个写法 和下面是一样的 不过这个你可以传递多个参数到list.jsp页面
* ModelAndView mv =new ModelAndView();
mv.setViewName("list");
mv.addObject("list", list);
return mv;
*/
return new ModelAndView("list", "list", list);
}
}

  list.jsp

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> <%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>"> <title>My JSP 'list.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
--> </head> <body> <table border="1px" cellpadding="3" cellspacing="2">
<thead>
<tr>
<td>雇员编号</td>
<td>姓名</td>
<td>工作</td>
<td>经理编号</td>
<td>入职日期</td>
<td>薪资</td>
<td>津贴</td>
<td>部门编号</td>
</tr>
</thead>
<tbody>
<c:forEach items="${list}" var="emp">
<tr>
<td>${emp.empno}</td>
<td>${emp.ename}</td>
<td>${emp.job}</td>
<td>${emp.mgr}</td>
<td><fmt:formatDate value="${emp.hiredate}" pattern="yyyy-MM-dd"/></td>
<td>${emp.sal}</td>
<td>${emp.deptno}</td>
<td><a href="getEmp.action?empno=${emp.empno}&flag=4">修改</a>   
<a href="delEmp.action?flag=3&empno=${emp.empno}">删除</a>
</td>
</tr>
</c:forEach>
</tbody>
</table>
</body>
</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. Delphi2010如何获取程序内部自身版本号?

    用原来的GetFileVersionInfo只能获取Delpi7的程序版本号,用在Delphi2010中就不管用了 //------ 获取文件版本号function F_GetFileVersion( ...

  2. DB通用类:SQL Server 通用类库

    SQLServer通用类A using System; using System.Data; using System.Data.SqlClient; using System.Collections ...

  3. python操作符与流程控制

    操作符: 算术运算: +   -   *  /  %  //   ** 逻辑运算:and or  not 身份运算: is     not is 不可变数据类型:数字  字符串  字典key 可变数据 ...

  4. Pyhton-Web框架之【Django】

    一.什么是web框架 框架,即framework,特指为解决一个开放性问题而设计的具有一定约束性的支撑结构,使用框架可以帮你快速开发特定的系统,简单地说,就是你用别人搭建好的舞台来做表演. 对于所有的 ...

  5. cdlinux写入u盘启动的制作教程

    制作方法如下:(摘自于https://blog.csdn.net/suquan629/article/details/52996792) 1.所需要的工具软件: cdlinux0.9.7.isoUlt ...

  6. uva-10887-枚举

    题意:集合S1和S2,把S2中的元素拼接到S1的后面去,生成新的元素,问有多少个不重复的元素 直接map.注意,不能用cin读取字符串,题目没有保证字符串中间没有空格 #include "p ...

  7. 39.纯 CSS 创作一个表达怀念童年心情的条纹彩虹心特效

    原文地址:https://segmentfault.com/a/1190000015126240 HTML code: <div class="heart"> < ...

  8. Javascript 中 null和undefined的区别

    null表示"没有对象",即该处不应该有值.典型用法是: (1) 作为函数的参数,表示该函数的参数不是对象. (2) 作为对象原型链的终点. Object.getPrototype ...

  9. Linux关键字查询

    grep -R "查询关键字" /目录/*

  10. python中的swapcase

    swapcase()将字符串中的字母小写变大写.大写变小写,举个例子: 1 a = "hELLO wORLD" 2 a1 = a.swapcase() 3 print(a1) 输出 ...