表单提交时,浏览器会对表单中文参数值进行编码(会使用打开该表单
所在页面时的字符集来编码),服务器端默认会使用iso-8859-1来解码。
所以会产生乱码。
可以使用SpringMVC提供的过滤器(CharacterEncodingFilter)来解决。
只需要配置该过滤器即可
<filter>
<filter-name>CharacterEncodingFilterfilter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilterfilter-class>
<init-param>
<param-name>encodingparam-name>
<param-value>UTF-8param-value>
init-param>
filter>
<filter-mapping>
<filter-name>CharacterEncodingFilterfilter-name>
<url-pattern>/*url-pattern>
filter-mapping>
数据库的创建
create database ems;
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0modelVersion>
<groupId>cn.companygroupId>
<artifactId>TestDemoartifactId>
<version>0.0.1-SNAPSHOTversion>
<packaging>warpackaging>
<dependencies>
<dependency>
<groupId>junitgroupId>
<artifactId>junitartifactId>
<version>4.12version>
<scope>testscope>
dependency>
<dependency>
<groupId>org.springframeworkgroupId>
<artifactId>spring-webmvcartifactId>
<version>5.2.5.RELEASEversion>
dependency>
<dependency>
<groupId>commons-dbcpgroupId>
<artifactId>commons-dbcpartifactId>
<version>1.4version>
dependency>
<dependency>
<groupId>mysqlgroupId>
<artifactId>mysql-connector-javaartifactId>
<version>8.0.19version>
dependency>
<dependency>
<groupId>javax.servletgroupId>
<artifactId>javax.servlet-apiartifactId>
<version>4.0.1version>
<scope>providedscope>
dependency>
<dependency>
<groupId>javax.servlet.jspgroupId>
<artifactId>javax.servlet.jsp-apiartifactId>
<version>2.3.3version>
<scope>providedscope>
dependency>
<dependency>
<groupId>jstlgroupId>
<artifactId>jstlartifactId>
<version>1.2version>
dependency>
dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.mavengroupId>
<artifactId>tomcat7-maven-pluginartifactId>
<version>2.2version>
<configuration>
<port>8080port>
<hostName>localhosthostName>
<uriEncoding>UTF-8uriEncoding>
configuration>
plugin>
plugins>
build>
project>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
<display-name>TestDemodisplay-name>
<servlet>
<servlet-name>springmvcservlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServletservlet-class>
<init-param>
<param-name>contextConfigLocationparam-name>
<param-value>classpath:annotation.xmlparam-value>
init-param>
<load-on-startup>1load-on-startup>
servlet>
<servlet-mapping>
<servlet-name>springmvcservlet-name>
<url-pattern>/url-pattern>
servlet-mapping>
<filter>
<filter-name>CharacterEncodingFilterfilter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilterfilter-class>
<init-param>
<param-name>encodingparam-name>
<param-value>UTF-8param-value>
init-param>
filter>
<filter-mapping>
<filter-name>CharacterEncodingFilterfilter-name>
<url-pattern>/*url-pattern>
filter-mapping>
web-app>
# database connection parameters
jdbc.driver=com.mysql.cj.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/ems?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8
jdbc.username=root
jdbc.password=root
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-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/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.3.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-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/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.8.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-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/util http://www.springframework.org/schema/util/spring-util-4.3.xsd">
<context:component-scan base-package="cn.ems"/>
<mvc:annotation-driven/>
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/"/>
<property name="suffix" value=".jsp"/>
bean>
<mvc:resources location="/" mapping="/**"/>
<util:properties id="db" location="classpath:db.properties"/>
<bean class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" id="ds">
<property name="driverClassName" value="#{db['jdbc.driver']}"/>
<property name="url" value="#{db['jdbc.url']}"/>
<property name="username" value="#{db['jdbc.username']}"/>
<property name="password" value="#{db['jdbc.password']}"/>
bean>
beans>
package cn.ems.entity;
/**
* 雇员类
*
* @author 86182
*
*/
public class Employee {
private int id;// 主键
private String ename;// 雇员名字
private double salary;// 薪水
private int age;// 年龄
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getEname() {
return ename;
}
public void setEname(String ename) {
this.ename = ename;
}
public double getSalary() {
return salary;
}
public void setSalary(double salary) {
this.salary = salary;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String toString() {
return "Employee [id=" + id + ", ename=" + ename + ", salary=" + salary + ", age=" + age + "]";
}
}
package cn.ems.entity;
/**
* 用户类
*
* @author 86182
*
*/
public class User {
private int id;// 主键
private String username;// 账号
private String name;// 名称
private String password;// 密码
private String gender;// 性别
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public String toString() {
return "User [id=" + id + ", username=" + username + ", name=" + name + ", password=" + password + ", gender="
+ gender + "]";
}
}
package cn.ems.dao;
import cn.ems.entity.User;
/**
*持久层接口
* @author 86182
*用户类接口
*/
public interface UserDAO {
public User findByUsername(String uname);
public void addUser(User user);
}
package cn.ems.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.annotation.Resource;
import javax.sql.DataSource;
import org.springframework.stereotype.Repository;
import cn.ems.entity.User;
/**
* 持久层实现类
*
* @author 86182
*
*/
@Repository("userDAO")
public class UserDAOJdbcImpl implements UserDAO {
@Resource(name = "ds")
DataSource ds;
/*
* 根据用户名查找用户
*/
public User findByUsername(String uname) {
Connection conn = null;
PreparedStatement ps = null;
ResultSet rs = null;
User user = null;
try {
conn = ds.getConnection();
String sql = "select * from t_user where username=?";
ps = conn.prepareStatement(sql);
ps.setString(1, uname);
rs = ps.executeQuery();
while (rs.next()) {
user = new User();
user.setId(rs.getInt("id"));
user.setUsername(uname);
user.setName(rs.getString("name"));
user.setPassword(rs.getString("password"));
user.setGender(rs.getString("gender"));
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (rs != null) {
try {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if (ps != null) {
try {
ps.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if (conn != null) {
try {
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
return user;
}
/*
* 添加用户信息
*/
public void addUser(User user) {
Connection conn = null;
PreparedStatement ps = null;
try {
conn = ds.getConnection();
String sql = "insert into t_user values(null,?,?,?,?)";
ps = conn.prepareStatement(sql);
ps.setString(1, user.getUsername());
ps.setString(2, user.getName());
ps.setString(3, user.getPassword());
ps.setString(4, user.getGender());
ps.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
} finally {
if (ps != null) {
try {
ps.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if (conn != null) {
try {
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
}
}
package cn.ems.dao;
import java.util.List;
import cn.ems.entity.Employee;
public interface EmployeeDAO {
public List<Employee>findAll();
public void addEmployee(Employee e);
public Employee findEmployeeById(int id);
public int updateEmployee(Employee e);
public void deleteEmployee(int id);
}
package cn.ems.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import javax.sql.DataSource;
import org.springframework.stereotype.Repository;
import cn.ems.entity.Employee;
/**
*职员类接口
*/
@Repository("employeeDAO")
public class EmployeeDAOJdbcImpl implements EmployeeDAO {
@Resource(name = "ds")
DataSource ds;
/*
* 查询所有的雇员信息
*/
public List<Employee> findAll() {
List<Employee> employeeList = new ArrayList<Employee>();
Connection conn = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
conn = ds.getConnection();
String sql = "select * from t_emp";
ps = conn.prepareStatement(sql);
rs = ps.executeQuery();
while (rs.next()) {
Employee e = new Employee();
e.setId(rs.getInt("id"));
e.setEname(rs.getString("ename"));
e.setSalary(rs.getDouble("salary"));
e.setAge(rs.getInt("age"));
employeeList.add(e);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (rs != null) {
try {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if (ps != null) {
try {
ps.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if (conn != null) {
try {
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
return employeeList;
}
/*
* 新增雇员
*/
public void addEmployee(Employee e) {
Connection conn = null;
PreparedStatement ps = null;
String sql = "insert into t_emp values(null,?,?,?)";
try {
conn = ds.getConnection();
ps = conn.prepareStatement(sql);
ps.setString(1, e.getEname());
ps.setDouble(2, e.getSalary());
ps.setInt(3, e.getAge());
ps.executeUpdate();
} catch (SQLException e1) {
e1.printStackTrace();
} finally {
if (ps != null) {
try {
ps.close();
} catch (SQLException e1) {
e1.printStackTrace();
}
}
if (conn != null) {
try {
conn.close();
} catch (SQLException e1) {
e1.printStackTrace();
}
}
}
}
/*
* 根据id查询雇员
*/
public Employee findEmployeeById(int id) {
Connection conn = null;
PreparedStatement ps = null;
ResultSet rs = null;
Employee e = null;
try {
conn = ds.getConnection();
String sql = "select * from t_emp where id=?";
ps = conn.prepareStatement(sql);
ps.setInt(1, id);
rs = ps.executeQuery();
while (rs.next()) {
e = new Employee();
e.setId(rs.getInt("id"));
e.setEname(rs.getString("ename"));
e.setSalary(rs.getDouble("salary"));
e.setAge(rs.getInt("age"));
}
} catch (SQLException e1) {
e1.printStackTrace();
}
return e;
}
/*
* 更新雇员信息
*/
public int updateEmployee(Employee e) {
int count = 0;
Connection conn = null;
PreparedStatement ps = null;
try {
conn = ds.getConnection();
String sql = "update t_emp set ename=?,salary=?,age=? where id=?";
ps = conn.prepareStatement(sql);
ps.setString(1, e.getEname());
ps.setDouble(2, e.getSalary());
ps.setInt(3, e.getAge());
ps.setInt(4, e.getId());
ps.executeUpdate();
} catch (SQLException e1) {
e1.printStackTrace();
} finally {
if (ps != null) {
try {
ps.close();
} catch (SQLException e1) {
e1.printStackTrace();
}
}
if (conn != null) {
try {
conn.close();
} catch (SQLException e1) {
e1.printStackTrace();
}
}
}
return count;
}
/**
* 根据id删除雇员
*/
public void deleteEmployee(int id) {
Connection conn = null;
PreparedStatement ps = null;
try {
conn = ds.getConnection();
String sql = "delete from t_emp where id=?";
ps = conn.prepareStatement(sql);
ps.setInt(1, id);
ps.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
} finally {
if (ps != null) {
try {
ps.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if (conn != null) {
try {
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
}
}
package cn.ems.service;
/**
* 应用异常类
* @author 86182
*
*/
public class AppException extends RuntimeException{
public AppException() {
}
public AppException(String message) {
super(message);
}
}
package cn.ems.service;
import cn.ems.entity.User;
/**
* 业务层接口
* @author 86182
*
*/
public interface LoginService {
public User checkLogin(String uname,String pwd);
public void addUser(User user);
}
package cn.ems.service;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import cn.ems.dao.UserDAO;
import cn.ems.entity.User;
/**
* 业务层实现类
* @author 86182
*
*/
@Service("loginService")
public class LoginServiceImpl implements LoginService {
@Resource(name = "userDAO")
UserDAO dao;
public User checkLogin(String uname, String pwd) {
User user=dao.findByUsername(uname);
if(user==null) {
/*
* 抛出应用异常:
* 因为用户错误的操作引起的异常,
* 需要明确提示用户采取正确的操作。
*/
throw new AppException("用户不存在");
}
if(!user.getPassword().equals(pwd)) {
throw new AppException("密码错误");
}
return user;
}
public void addUser(User user) {
dao.addUser(user);
}
}
package cn.ems.service;
import java.util.List;
import cn.ems.entity.Employee;
public interface EmpService {
public List<Employee>findAll();
public void addEmployee(Employee e);
public Employee findEmployeeById(int id);
public int updateEmployee(Employee e);
public void deleteEmployee(int id);
}
package cn.ems.service;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import cn.ems.dao.EmployeeDAO;
import cn.ems.entity.Employee;
@Service("empService")
public class EmpServiceImpl implements EmpService {
@Resource(name = "employeeDAO")
EmployeeDAO dao;
public List<Employee> findAll() {
List<Employee> employees = dao.findAll();
return employees;
}
public void addEmployee(Employee e) {
dao.addEmployee(e);
}
public Employee findEmployeeById(int id) {
return dao.findEmployeeById(id);
}
public int updateEmployee(Employee e) {
return dao.updateEmployee(e);
}
public void deleteEmployee(int id) {
dao.deleteEmployee(id);
}
}
package cn.ems.controller;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import cn.ems.entity.User;
import cn.ems.service.AppException;
import cn.ems.service.LoginService;
@Controller
public class LoginController {
@Resource(name = "loginService")
LoginService loginService;
@RequestMapping("/toLogin")
public String toLogin() {
return "login";
}
@RequestMapping("/login")
public String login(String uname,String pwd,Model model) {
//将登录请求分发给业务层的对象来处理
try {
User user=loginService.checkLogin(uname, pwd);
}catch(Exception e) {
e.printStackTrace();
if(e instanceof AppException) {
model.addAttribute("login_failed",e.getMessage());
return "login";
}
//系统异常
return "error";
}
//登录成功,重定向到首页
return "redirect:toIndex";
}
@RequestMapping("/toIndex")
public String toIndex() {
return "index";
}
@RequestMapping("/regesit")
public String regesit() {
return "regesit";
}
@RequestMapping("/addUser")
public String addUser(User user) {
loginService.addUser(user);
System.out.println("新增"+user.getName()+"成功!");
return "redirect:toLogin";
}
}
package cn.ems.controller;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import cn.ems.entity.Employee;
import cn.ems.service.EmpService;
@Controller
public class EmpController {
@Resource(name = "empService")
private EmpService empService;
@RequestMapping("/list")
public String list(Model model) {
List<Employee>employees=new ArrayList<Employee>();
try {
employees=empService.findAll();
}catch(Exception e) {
e.printStackTrace();
return "error";
}
model.addAttribute("employees",employees);
return "empList";
}
@RequestMapping("/toAdd")
public String toAdd() {
return "addEmp";
}
@RequestMapping("/add")
public String add(Employee e) {
empService.addEmployee(e);
return "redirect:list";
}
@RequestMapping("/load")
public String load(int id,Model model) {
Employee emp=empService.findEmployeeById(id);
model.addAttribute("emp",emp);
return "updateEmp";
}
@RequestMapping("/update")
public String update(Employee e) {
int count=empService.updateEmployee(e);
System.out.println("更新了"+count+"条数据");
return "redirect:list";
}
@RequestMapping("/delete")
public String delete(int id) {
empService.deleteEmployee(id);
return "redirect:list";
}
}
页面的展示
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html>
<head>
<meta charset="UTF-8">
<title>title>
head>
<body>
<form action="add" method="post">
<fieldset>
<legend>添加员工legend>
姓名:<input name="ename"><br>
薪水:<input name="salary"><br>
年龄:<input name="age"><br>
<input type="submit" value="添加">
fieldset>
form>
body>
html>
<%@ page pageEncoding="utf-8"
contentType="text/html; charset=utf-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<title>员工管理title>
<link rel="stylesheet"
type="text/css" href="css/style.css" />
head>
<body>
<div id="wrap">
<div id="top_content">
<%@ include file="header.jsp" %>
<div id="content">
<p id="whereami">
p>
<h1>
员工列表
h1>
<table class="table">
<tr class="table_header">
<td>
ID
td>
<td>
姓名
td>
<td>
薪水
td>
<td>
年龄
td>
<td>
操作
td>
tr>
<c:forEach items="${employees}" var="e"
varStatus="s">
<tr class="row${s.index % 2 + 1}">
<td>
${e.id}
td>
<td>
${e.ename}
td>
<td>
${e.salary}
td>
<td>
${e.age}
td>
<td>
<a href="delete?id=${e.id}"
onclick="return confirm('确定删除${e.ename}');">删除a>
<a href="load?id=${e.id}">修改a>
td>
tr>
c:forEach>
table>
<p>
<input type="button" class="button"
value="添加员工"
onclick="location='toAdd'"/>
p>
div>
div>
<%@ include file="footer.jsp" %>
div>
body>
html>
<%@page pageEncoding="utf-8"
contentType="text/html; charset=utf-8" %>
<html>
<head>head>
<body style="font-size:30px;">
系统繁忙,稍后重试
body>
html>
<div id="footer">
<div id="footer_bg">[email protected]div>
div>
<%@page import="java.util.Date,java.text.SimpleDateFormat"%>
<div id="header">
<div id="rightheader">
<p>
<%
Date date=new Date();
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
String now=sdf.format(date);
%>
<%=now %>
<br />
p>
div>
<div id="topheader">
<h1 id="title">
<a href="#">maina>
h1>
div>
<div id="navigation">div>
div>
<%@page pageEncoding="utf-8"
contentType="text/html; charset=utf-8" %>
<html>
<head>head>
<body style="font-size:30px;">
首页
body>
html>
<%@ page pageEncoding="utf-8"
contentType="text/html; charset=utf-8" %>
<html>
<head>
<title>登录title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css"
href="css/style.css" />
head>
<body>
<div id="wrap">
<div id="top_content">
<div id="header">
<div id="rightheader">
<p>
2020/04/13
<br />
p>
div>
<div id="topheader">
<h1 id="title">
<a href="#">maina>
h1>
div>
<div id="navigation">
div>
div>
<div id="content">
<p id="whereami">
p>
<h1>
登录
h1>
<form action="login" method="post">
<table cellpadding="0" cellspacing="0" border="0"
class="form_table">
<tr>
<td valign="middle" align="right">
用户名:
td>
<td valign="middle" align="left">
<input type="text" class="inputgri"
name="uname" />
<span style="color:red;font-size:24px;">
${login_failed}
span>
td>
tr>
<tr>
<td valign="middle" align="right">
密码:
td>
<td valign="middle" align="left">
<input type="password" class="inputgri"
name="pwd" />
td>
tr>
table>
<p>
<input type="submit" class="button"
value="确定" />
p>
form>
div>
div>
<div id="footer">
<div id="footer_bg">
[email protected]
div>
div>
div>
body>
html>
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html>
<head>
<meta charset="UTF-8">
<title>title>
head>
<body>
<form action="addUser" method="post">
<fieldset>
<legend>注册账号legend>
账号:<input name="username"><br>
名称:<input name="name"><br>
密码:<input name="password" type="password"><br>
性别:
男<input type="radio" name="gender" value="男">
女<input type="radio" name="gender" value="女"><br>
<input type="submit" value="添加">
fieldset>
form>
body>
html>
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
<meta charset="UTF-8">
<title>title>
head>
<body>
<form action="update" method="post">
<fieldset>
<legend>员工信息的修改legend>
<input type="hidden" value="${emp.id }" name="id">
姓名:<input name="ename" value="${emp.ename }"><br>
薪水:<input name="salary" value="${emp.salary }"><br>
年龄:<input name="age" value="${emp.age }"><br>
<input type="submit" value="修改">
fieldset>
form>
body>
html>
源码