SSM框架搭建实例

SSM框架搭建简单实例 - 搭建步骤


需求分析:

   实现用户表信息的增删改查


1. 开发环境

  • 环境  : JDK  1.8         
  • 软件 : myeclipse       
  • 数据库 : MySql

2. 创建数据库

  • 数据库名称:ssm           
  • 字符集:UTF-8         
  • 表 : user

3. 工程搭建

  •   工程使用Springmvc、spring、mybatis框架整合完成。
  • 项目完整目录截图

4. 创建web工程

  • 准备需要的jar包
  1. spring(包括springmvc)
  2. mybatis
  3. mybatis-spring整合包
  4. 数据库驱动
  5. 第三方连接池。
  6. Json依赖包(springmvc 自带,可不加)
  • web.xml  文件

       需要配置的有  : Spring监听器, SpringMVC 核心前端控制器, 字符集过滤器

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
  <display-name>SSM</display-name>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
  
  <!-- Spring 监听器 -->
  <context-param>
  	<param-name>contextConfigLocation</param-name>
  	<param-value>classpath:applicationContext.xml</param-value>
  </context-param>
  <listener>
  	<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>
  
  <!-- 配置 SpingMVC 核心前端处理器 -->
  <servlet>
  	<servlet-name>springmvcDispatcherServlet</servlet-name>
  	<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
  	<init-param>
  		<param-name>contextConfigLocation</param-name>
  		<param-value>classpath:springmvc.xml</param-value>
  	</init-param>
  </servlet>
  <servlet-mapping>
  	<servlet-name>springmvcDispatcherServlet</servlet-name>
  	<url-pattern>*.action</url-pattern>
  </servlet-mapping>
  
  <!-- 字符集过滤器 -->
  <filter>
  	<filter-name>characterEncodingFilter</filter-name>
  	<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
  	<init-param>
  		<param-name>encoding</param-name>
  		<param-value>UTF-8</param-value>
  	</init-param>
  </filter>
  <filter-mapping>
  	<filter-name>characterEncodingFilter</filter-name>
  	<url-pattern>/*</url-pattern>
  </filter-mapping>
  
  
</web-app>

三个框架的配置文件,统一放在 conf 文件夹下(source folder 文件夹)

  • applicationContext.xml    【Spring 的 配置文件】

<?xml version="1.0" encoding="UTF-8"?>
<beans
	xmlns="http://www.springframework.org/schema/beans"
	xmlns:util="http://www.springframework.org/schema/util"
	xmlns:p="http://www.springframework.org/schema/p"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:aop="http://www.springframework.org/schema/aop"
	xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:mvc="http://www.springframework.org/schema/mvc"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/beans 
	http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
	http://www.springframework.org/schema/util 
	http://www.springframework.org/schema/util/spring-util-4.3.xsd
	http://www.springframework.org/schema/context 
	http://www.springframework.org/schema/context/spring-context-4.3.xsd
	http://www.springframework.org/schema/aop
	http://www.springframework.org/schema/aop/spring-aop-4.3.xsd
	http://www.springframework.org/schema/tx
	http://www.springframework.org/schema/tx/spring-tx-4.3.xsd
	http://www.springframework.org/schema/mvc
	http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd">
	
	<!-- 自动扫描注解 spring 负责dao/mapper和service 层 -->
	<context:component-scan base-package="top.vkiss.ssm.mapper"></context:component-scan>
	<context:component-scan base-package="top.vkiss.ssm.service"></context:component-scan>
	
	<!-- 读取db.properties -->
	<context:property-placeholder location="classpath:db.properties"/>
	
	<!-- 配置数据源   -不读取 db.properties 时,直接在 value属性中赋予数据库连接属性值-->
	<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
		<property name="driverClassName" value="${driverClass}"></property>	
		<property name="url" value="${url}"></property>	
		<property name="username" value="${user}"></property>	
		<property name="password" value="${pwd}"></property>	
	</bean>
	
	<!-- 配置 SQLSessionFactory -->
	<bean id="sqlSessionFactoryBean" class="org.mybatis.spring.SqlSessionFactoryBean">
		<!-- 加载数据源 -->
		<property name="dataSource" ref="dataSource"></property>
		<!-- 自动扫描 Mapper 文件 -->
		<property name="mapperLocations" value="classpath:top/vkiss/ssm/mapper/*.xml"></property>
		<!-- 属性文件 -->
		<property name="configLocation" value="classpath:SqlMapConfig.xml"></property>
	</bean>
	
	<!-- 自扫描Dao/Mapper接口类,生成实体类 -->
	<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
		<!-- 扫描制定包的接口 -->
		<property name="basePackage" value="top.vkiss.ssm.mapper"></property>
		<!-- 注入 SqlSessinFaction bean -->
		<property name="sqlSessionFactoryBeanName" value="sqlSessionFactoryBean"></property>
	</bean>
		
	<!-- 事务管理器 -->
	<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
		<property name="dataSource" ref="dataSource"></property>
	</bean>
	
	<!-- 事务通知 -->
	<tx:advice id="txAcvice" transaction-manager="transactionManager">
		<!--事务的传播属性 -->
		<tx:attributes>
			<tx:method name="add*" propagation="REQUIRED"/>
			<tx:method name="edit*" propagation="REQUIRED"/>
			<tx:method name="del*" propagation="REQUIRED"/>
			<tx:method name="save*" propagation="REQUIRED"/>
			<tx:method name="update*" propagation="REQUIRED"/>
			<tx:method name="insert*" propagation="REQUIRED"/>
			<tx:method name="get*" propagation="REQUIRED" read-only="true"/>
			<tx:method name="query*" propagation="REQUIRED" read-only="true"/>
			<!-- 简单的可以直接配置  name="*"   -->
			<tx:method name="*" propagation="REQUIRED"/>
		</tx:attributes>
	</tx:advice>
	
	<!-- AOP 面向切面事务 -->
	<aop:config>
		<aop:pointcut expression="execution( * top.vkiss.ssm.service.*.*(..))" id="exep1"/>
		<aop:advisor advice-ref="txAcvice" pointcut-ref="exep1"/>		
	</aop:config>
	
</beans>
  • springmvc.xml    【SpringMVC 的 配置文件】

<?xml version="1.0" encoding="UTF-8"?>
<beans
	xmlns="http://www.springframework.org/schema/beans"
	xmlns:util="http://www.springframework.org/schema/util"
	xmlns:p="http://www.springframework.org/schema/p"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:aop="http://www.springframework.org/schema/aop"
	xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:mvc="http://www.springframework.org/schema/mvc"
	xmlns:task="http://www.springframework.org/schema/task"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/beans 
	http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
	http://www.springframework.org/schema/util 
	http://www.springframework.org/schema/util/spring-util-4.3.xsd
	http://www.springframework.org/schema/context 
	http://www.springframework.org/schema/context/spring-context-4.3.xsd
	http://www.springframework.org/schema/aop 
	http://www.springframework.org/schema/aop/spring-aop-4.3.xsd
	http://www.springframework.org/schema/tx 
	http://www.springframework.org/schema/tx/spring-tx-4.3.xsd
	http://www.springframework.org/schema/mvc 
	http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
	http://www.springframework.org/schema/task 
	http://www.springframework.org/schema/task/spring-task-4.3.xsd">

	<!-- 扫描 处理器 bean 的 注解 -->
	<context:component-scan base-package="top.vkiss.ssm.controller"></context:component-scan>
	<context:component-scan base-package="top.vkiss.ssm.task"></context:component-scan>
	
	<!-- MVC 注解驱动 -->
	<mvc:annotation-driven></mvc:annotation-driven>
	
	<!-- 定时器注解驱动 -->
	<task:annotation-driven/>
	
	<!--  非注解 -配置 任务定时器    -配置文件加载时,先加载spring的配置文件,可能会出现不能执行的情况,当SpringMVC配置文件加载时,定时器方能执行
	<bean id="ta" class="top.vkiss.ssm.task.myTask"></bean>
	<task:scheduled-tasks>
		<task:scheduled ref="ta" method="zhh" cron="*/10 * * * * ?"/>
	</task:scheduled-tasks>	
	-->
	
	<!-- 视图解析器 -->
	<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
		<!-- 配置视图地址的前缀 -->
		<property name="prefix" value="/jsp/"></property>
		<!-- 配置视图地址的后缀 -->
		<property name="suffix" value=".jsp"></property>
	</bean>

</beans>
  • SqlMapConfig.xml    【MyBatis 的 配置文件】

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
	
	<settings>
        <!-- 二级缓存 默认为true  可不写 --> 
		<setting name="cacheEnabled" value="true"/>
        <!-- 懒加载 / 延迟加载 默认为true  可不写 --> 
		<setting name="lazyLoadingEnabled" value="true"/>
		<!-- 修改该配置为  按需加载 -->
		<setting name="aggressiveLazyLoading" value="false"/>
	</settings>
	
	<typeAliases>
		<package name="top.vkiss.ssm.domain"/>
	</typeAliases>
	
</configuration>
  • db.properties        【数据库配置文件】

driverClass=com.mysql.jdbc.Driver
url=jdbc\:mysql\://localhost\:3306/ssm
user=root
pwd=root
  • log4j.properties    【日志配置文件】

# Global logging configuration
#\u5728\u5f00\u53d1\u73af\u5883\u4e0b\u65e5\u5fd7\u7ea7\u522b\u8981\u8bbe\u7f6e\u6210DEBUG\uff0c\u751f\u4ea7\u73af\u5883\u8bbe\u7f6e\u6210info\u6216error
log4j.rootLogger=DEBUG, stdout
# Console output...
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n

 

  • User.java     【实体类 POJO,     所在包:top.vkiss.ssm.domain】

package top.vkiss.ssm.domain;

public class User {
    private Integer uid;
    private String uname;
    private String phone;
    private String address;
    // 这里省略了getter / setter  方法
}
  • UserMapper.java    【dao层接口,     所在包:top.vkiss.ssm.mapper】

package top.vkiss.ssm.mapper;

import java.util.List;

import top.vkiss.ssm.domain.User;

public interface UserMapper {
	
	public void addUser(User user) throws Exception;
	public void delUser(Integer id) throws Exception;
	public void editUser(User user) throws Exception;
	public User getUser(Integer id) throws Exception;
	public List<User> queryAll() throws Exception;

}
  • UserMapper.xml  【dao层mybatis 映射文件,可逆向生成   所在包:top.vkiss.ssm.mapper】

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="top.vkiss.ssm.mapper.UserMapper" >

  <resultMap id="BaseResultMap" type="top.vkiss.ssm.domain.User" >
    <id column="uid" property="uid" jdbcType="INTEGER" />
    <result column="uname" property="uname" jdbcType="VARCHAR" />
    <result column="phone" property="phone" jdbcType="VARCHAR" />
    <result column="address" property="address" jdbcType="VARCHAR" />
  </resultMap>
  
  <sql id="Base_Column_List" >
    uid, uname, phone, address
  </sql>
  
  <!-- 查一条 -->
  <select id="getUser" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from user
    where uid = #{uid,jdbcType=INTEGER}
  </select>
  
  <!-- 查所有 -->
  <select id="queryAll" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from user
  </select>
  
  <!-- 删一条 -->
  <delete id="delUser" parameterType="java.lang.Integer" >
    delete from user
    where uid = #{uid,jdbcType=INTEGER}
  </delete>
  
		  <!-- 添加一条 
		  <insert id="insert" parameterType="top.vkiss.ssm.domain.User" >
		    insert into user (uid, uname, phone, 
		      address)
		    values (#{uid,jdbcType=INTEGER}, #{uname,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, 
		      #{address,jdbcType=VARCHAR})
		  </insert>
		  -->
		  
  <!-- 添加一条 -->
  <insert id="addUser" parameterType="top.vkiss.ssm.domain.User" >
    insert into user
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="uid != null" >
        uid,
      </if>
      <if test="uname != null" >
        uname,
      </if>
      <if test="phone != null" >
        phone,
      </if>
      <if test="address != null" >
        address,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="uid != null" >
        #{uid,jdbcType=INTEGER},
      </if>
      <if test="uname != null" >
        #{uname,jdbcType=VARCHAR},
      </if>
      <if test="phone != null" >
        #{phone,jdbcType=VARCHAR},
      </if>
      <if test="address != null" >
        #{address,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  
  <!-- 更新 -->
  <update id="editUser" parameterType="top.vkiss.ssm.domain.User" >
    update user
    <set >
      <if test="uname != null" >
        uname = #{uname,jdbcType=VARCHAR},
      </if>
      <if test="phone != null" >
        phone = #{phone,jdbcType=VARCHAR},
      </if>
      <if test="address != null" >
        address = #{address,jdbcType=VARCHAR},
      </if>
    </set>
    where uid = #{uid,jdbcType=INTEGER}
  </update>

</mapper>
  • UserService.java  【Servioce 层接口 ,     所在包:top.vkiss.ssm.service】

package top.vkiss.ssm.service;

import java.util.List;

import top.vkiss.ssm.domain.User;

public interface UserService {
	public void addUser(User user) throws Exception;
	public void delUser(Integer id) throws Exception;
	public void editUser(User user) throws Exception;
	public User getUser(Integer id) throws Exception;
	public List<User> queryAll() throws Exception;
}
  • UserServiceImpl.java   【Servioce 层实现类 ,     所在包:top.vkiss.ssm.service】

package top.vkiss.ssm.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import top.vkiss.ssm.domain.User;
import top.vkiss.ssm.mapper.UserMapper;
@Service
public class UserServiceImpl implements UserService {
	@Autowired
	private UserMapper ud;
	@Override
	public void addUser(User user) throws Exception {
		// TODO Auto-generated method stub
		ud.addUser(user);
	}

	@Override
	public void delUser(Integer id) throws Exception {
		// TODO Auto-generated method stub
		ud.delUser(id);
	}

	@Override
	public void editUser(User user) throws Exception {
		// TODO Auto-generated method stub
		ud.editUser(user);
	}

	@Override
	public User getUser(Integer id) throws Exception {
		// TODO Auto-generated method stub
		return ud.getUser(id);
	}

	@Override
	public List<User> queryAll() throws Exception {
		// TODO Auto-generated method stub
		return ud.queryAll();
	}

}
  • UserController.java   【Controller 层 接收前端请求 ,     所在包:top.vkiss.ssm.controller】

package top.vkiss.ssm.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import top.vkiss.ssm.domain.User;
import top.vkiss.ssm.service.UserService;

@Controller
public class UserController {
	@Autowired
	private UserService us;
	
	@RequestMapping("/queryAll")
	public String queryAll(Model model) throws Exception{
		model.addAttribute("uList", us.queryAll());
		return "shouye";
	}
	
	@RequestMapping("/addUser")
	public String addUser(User user) throws Exception {
		System.out.println("addUser:"+user);
		us.addUser(user);
		return "redirect:queryAll.action";
	}
	
	@RequestMapping("/delUser")
	public String delUser(Integer id) throws Exception {
		System.out.println("del_id:"+id);
		us.delUser(id);
		return "redirect:queryAll.action";
	}
	
	@RequestMapping("/delS")
	public String delS(int[] ids) throws Exception {
		System.out.println("del_id:"+ids);
		for (int i : ids) {
			us.delUser(i);
		}
		return "redirect:queryAll.action";
	}
	
	@RequestMapping("/editUser")
	public String editUser(User user) throws Exception {
		System.out.println(user.getUname());
		us.editUser(user);
		return "redirect:queryAll.action";
	}
	
	@RequestMapping("/getUser")
	public String getUser(Model model,Integer id) throws Exception {
		System.out.println(id);
		System.out.println("...."+us.getUser(id));
		model.addAttribute("u", us.getUser(id));
		return "edit";
	}
	
	@RequestMapping("/showAdd")
	public String showAdd() throws Exception {
		return "addUs";
	}
}
  • myTask.java   【其他  层   SpringMVC 定时器 ,     所在包:top.vkiss.ssm.task】

package top.vkiss.ssm.task;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 *  本项目中没有用到,仅作学习使用
 */


@Component("task")
public class myTask {
	@Scheduled(cron="* * * * * *")
	public void zhh(){
		System.out.println("999999999999999");
	}
}

页面资源

index.jsp   项目启动用于重定向跳转

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
response.sendRedirect("queryAll.action");
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'index.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>
    This is my JSP page. <br>
  </body>
</html>

shouye,jsp    列表页 用于展示用户数据

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
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 'index.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">
	<script type="text/javascript" src="../js/jquery-1.8.3.min.js"></script>
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script type="text/javascript">
	
		function dels(){
			var ids= new Array();
			alert(ids);
			var bb = $("._checked").val();
			alert(bb);
			$.each($("table tbody input[type=checkbox]:checked"),function(){
				alert(1);
        	})
        	
       		alert("2");
		
		}
	
	</script>
  </head>
  
  <body>
    This Is My First SSM Application. <br>
    <div align="center">
    	<table >
	    	<tr>
	    		<td><button onclick="dels()">点击删除多条</button></td>
	    		<td>UID</td>
	    		<td>姓名</td>
	    		<td>性别</td>
	    		<td>地址</td>
	    		<td>操作</td>
	    	</tr>
	    	<tbody>
	    	<c:forEach items="${uList}" var="u">
		    	<tr>
		    		<td><input type="checkbox" name="checkbox" class="_checked" value="${u.uid }"> </td>
		    		<td>${u.uid }</td>
		    		<td>${u.uname }</td>
		    		<td>${u.phone }</td>
		    		<td>${u.address }</td>
		    		<td><a href="getUser.action?id=${u.uid }">【修改】</a><a href="delUser.action?id=${u.uid }">【删除】</a></td>
		    	</tr>
	    	</c:forEach>
	    	</tbody>
    	</table>
    	<p><a href="showAdd.action">点击添加</a></p>
    	<p></p>
    </div>
  </body>
</html>

addUs.jsp    添加用户页面

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
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 'index.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">
	-->
	<script type="text/javascript">
	
	</script>
  </head>
  
  <body>
      <div align="center">
         <form action="addUser.action" method="post">
            <p>
            	姓名:<input type="text" name="uname" value="${u.name}"/>
            </p>
            <p>
         		性别:<input type="text" name="phone" value="${u.phone}"/>
            </p>
            <p>
       			地址:<input type="text" name="address" value="${u.address}"/>
            </p>
            <p>
             <input type="submit" value="提交"/>
            </p>
         </form>
      </div>
  </body>
</html>

edit.jsp        修改页面

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
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 'index.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>
      <div align="center">
         <form action="editUser.action" method="post">
            <p>
            	<input type="hidden" name="uid" value="${u.uid}"/>
            	姓名:<input type="text" name="uname" value="${u.uname}"/>
            </p>
            <p>
         		性别:<input type="text" name="phone" value="${u.phone}"/>
            </p>
            <p>
       			地址:<input type="text" name="address" value="${u.address}"/>
            </p>
            <p>
             <input type="submit" value="修改"/>
            </p>
         </form>
      </div>
  </body>
</html>

至此简单SSM项目整合完毕

附带项目源码:SSM项目整合   

所用Jar包 截图

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  • 4
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值