SpringMVC实战--构建学生管理系统(02)
登陆页面制作
(源代码见仓库:https://gitee.com/jianghao233/course)
文件目录:(jar 包与上篇博客相同)
代码:
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<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_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>course</display-name>
<!-- needed for ContextLoaderListener -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:beans.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>springmvc</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>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Map all requests to the DispatcherServlet for handling -->
<servlet-mapping>
<servlet-name>springmvc</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
beans.xml
<?xml version="1.0" encoding="UTF-8"?>
<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:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.2.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.2.xsd">
<context:component-scan base-package="com.neuedu.service"></context:component-scan>
<context:property-placeholder location="classpath:jdbc.properties"/>
<!-- 配置数据源 -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="user" value="${jdbc.user}"></property>
<property name="password" value="${jdbc.password}"></property>
<property name="driverClass" value="${jdbc.driverClass}"></property>
<property name="jdbcUrl" value="${jdbc.jdbcUrl}"></property>
<property name="initialPoolSize" value="${jdbc.initialPoolSize}"></property>
<property name="maxPoolSize" value="${jdbc.maxPoolSize}"></property>
</bean>
<!-- 整合mybatis -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<property name="typeAliasesPackage" value="com.neuedu.po"></property>
</bean>
<!-- 扫描那个包 -->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.neuedu.mapper"></property>
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"></property>
</bean>
<!-- 声明式事务管理 -->
<!-- 配置事务管理器 -->
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"></property>
</bean>
<!--
配置事务的属性
-->
<tx:advice id="txadvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="get*" read-only="true"/>
<tx:method name="save*" propagation="REQUIRES_NEW"/>
<tx:method name="update*" propagation="REQUIRES_NEW"/>
<tx:method name="delete*" propagation="REQUIRES_NEW"/>
<tx:method name="*"/>
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut expression="execution(* com.neuedu.service..*.*(..))" id="myPointcut"/>
<aop:advisor advice-ref="txadvice" pointcut-ref="myPointcut"/>
</aop:config>
</beans>
jdbc.properties
jdbc.user=root
jdbc.password=439901
jdbc.driverClass=com.mysql.jdbc.Driver
jdbc.jdbcUrl=jdbc:mysql://localhost:3306/course
jdbc.initialPoolSize=5
jdbc.maxPoolSize=20
springmvc.xml
<?xml version="1.0" encoding="UTF-8"?>
<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:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd">
<!-- springmvc 只负责 controller层 -->
<context:component-scan base-package="com.neuedu.controller"></context:component-scan>
<!-- 配置视图解析器 -->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/"></property>
<property name="suffix" value=".jsp"></property>
</bean>
<mvc:annotation-driven></mvc:annotation-driven>
<!-- 映射静态资源 -->
<mvc:resources location="/static/" mapping="/static/**"></mvc:resources>
<!-- url地址为static开头的,全部映射到 static文件夹下,里面存储静态页面的样式;
不用经过spring映射,因为spring映射会将外部网络引用的文件全部拦截 -->
</beans>
SelectionMapper.xml
<?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="com.neuedu.mapper.SelectionMapper" >
<resultMap id="BaseResultMap" type="com.neuedu.po.Selection" >
<id column="selid" property="selid" jdbcType="INTEGER" />
<result column="stuid" property="stuid" jdbcType="INTEGER" />
<result column="courseid" property="courseid" jdbcType="INTEGER" />
<result column="year" property="year" jdbcType="INTEGER" />
<result column="term" property="term" jdbcType="CHAR" />
<result column="grade" property="grade" jdbcType="DOUBLE" />
</resultMap>
<sql id="Base_Column_List" >
selid, stuid, courseid, year, term, grade
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from selection
where selid = #{selid,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from selection
where selid = #{selid,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.neuedu.po.Selection" >
insert into selection (selid, stuid, courseid,
year, term, grade)
values (#{selid,jdbcType=INTEGER}, #{stuid,jdbcType=INTEGER}, #{courseid,jdbcType=INTEGER},
#{year,jdbcType=INTEGER}, #{term,jdbcType=CHAR}, #{grade,jdbcType=DOUBLE})
</insert>
<insert id="insertSelective" parameterType="com.neuedu.po.Selection" >
insert into selection <!-- 选择性插入 -->
<trim prefix="(" suffix=")" suffixOverrides=","> <!-- 去掉最后一个 , -->
<if test="selid != null" >
and selid,
</if>
<if test="stuid != null" >
stuid,
</if>
<if test="courseid != null" >
courseid,
</if>
<if test="year != null" >
year,
</if>
<if test="term != null" >
term,
</if>
<if test="grade != null" >
grade,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="selid != null" >
#{selid,jdbcType=INTEGER},
</if>
<if test="stuid != null" >
#{stuid,jdbcType=INTEGER},
</if>
<if test="courseid != null" >
#{courseid,jdbcType=INTEGER},
</if>
<if test="year != null" >
#{year,jdbcType=INTEGER},
</if>
<if test="term != null" >
#{term,jdbcType=CHAR},
</if>
<if test="grade != null" >
#{grade,jdbcType=DOUBLE},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.neuedu.po.Selection" >
update selection
<set >
<if test="stuid != null" >
stuid = #{stuid,jdbcType=INTEGER},
</if>
<if test="courseid != null" >
courseid = #{courseid,jdbcType=INTEGER},
</if>
<if test="year != null" >
year = #{year,jdbcType=INTEGER},
</if>
<if test="term != null" >
term = #{term,jdbcType=CHAR},
</if>
<if test="grade != null" >
grade = #{grade,jdbcType=DOUBLE},
</if>
</set>
where selid = #{selid,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.neuedu.po.Selection" >
update selection
set stuid = #{stuid,jdbcType=INTEGER},
courseid = #{courseid,jdbcType=INTEGER},
year = #{year,jdbcType=INTEGER},
term = #{term,jdbcType=CHAR},
grade = #{grade,jdbcType=DOUBLE}
where selid = #{selid,jdbcType=INTEGER}
</update>
</mapper>
TbAdminMapper.xml
<?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="com.neuedu.mapper.TbAdminMapper" >
<resultMap id="BaseResultMap" type="com.neuedu.po.TbAdmin" >
<id column="adminid" property="adminid" jdbcType="INTEGER" />
<result column="username" property="username" jdbcType="VARCHAR" />
<result column="password" property="password" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
adminid, username, password
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from tb_admin
where adminid = #{adminid,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from tb_admin
where adminid = #{adminid,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.neuedu.po.TbAdmin" >
insert into tb_admin (adminid, username, password
)
values (#{adminid,jdbcType=INTEGER}, #{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.neuedu.po.TbAdmin" >
insert into tb_admin
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="adminid != null" >
adminid,
</if>
<if test="username != null" >
username,
</if>
<if test="password != null" >
password,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="adminid != null" >
#{adminid,jdbcType=INTEGER},
</if>
<if test="username != null" >
#{username,jdbcType=VARCHAR},
</if>
<if test="password != null" >
#{password,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.neuedu.po.TbAdmin" >
update tb_admin
<set >
<if test="username != null" >
username = #{username,jdbcType=VARCHAR},
</if>
<if test="password != null" >
password = #{password,jdbcType=VARCHAR},
</if>
</set>
where adminid = #{adminid,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.neuedu.po.TbAdmin" >
update tb_admin
set username = #{username,jdbcType=VARCHAR},
password = #{password,jdbcType=VARCHAR}
where adminid = #{adminid,jdbcType=INTEGER}
</update>
</mapper>
TbClassMapper.xml
<?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="com.neuedu.mapper.TbClassMapper" >
<resultMap id="BaseResultMap" type="com.neuedu.po.TbClass" >
<id column="classid" property="classid" jdbcType="INTEGER" />
<result column="classname" property="classname" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
classid, classname
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from tb_class
where classid = #{classid,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from tb_class
where classid = #{classid,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.neuedu.po.TbClass" >
insert into tb_class (classid, classname)
values (#{classid,jdbcType=INTEGER}, #{classname,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.neuedu.po.TbClass" >
insert into tb_class
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="classid != null" >
classid,
</if>
<if test="classname != null" >
classname,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="classid != null" >
#{classid,jdbcType=INTEGER},
</if>
<if test="classname != null" >
#{classname,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.neuedu.po.TbClass" >
update tb_class
<set >
<if test="classname != null" >
classname = #{classname,jdbcType=VARCHAR},
</if>
</set>
where classid = #{classid,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.neuedu.po.TbClass" >
update tb_class
set classname = #{classname,jdbcType=VARCHAR}
where classid = #{classid,jdbcType=INTEGER}
</update>
</mapper>
TbStudentMapper.xml
<?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="com.neuedu.mapper.TbStudentMapper" >
<resultMap id="BaseResultMap" type="com.neuedu.po.TbStudent" >
<id column="stuid" property="stuid" jdbcType="INTEGER" />
<result column="stunum" property="stunum" jdbcType="CHAR" />
<result column="stuname" property="stuname" jdbcType="VARCHAR" />
<result column="password" property="password" jdbcType="VARCHAR" />
<result column="classid" property="classid" jdbcType="INTEGER" />
<result column="picurl" property="picurl" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
stuid, stunum, stuname, password, classid, picurl
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from tb_student
where stuid = #{stuid,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from tb_student
where stuid = #{stuid,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.neuedu.po.TbStudent" >
insert into tb_student (stuid, stunum, stuname,
password, classid, picurl
)
values (#{stuid,jdbcType=INTEGER}, #{stunum,jdbcType=CHAR}, #{stuname,jdbcType=VARCHAR},
#{password,jdbcType=VARCHAR}, #{classid,jdbcType=INTEGER}, #{picurl,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.neuedu.po.TbStudent" >
insert into tb_student
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="stuid != null" >
stuid,
</if>
<if test="stunum != null" >
stunum,
</if>
<if test="stuname != null" >
stuname,
</if>
<if test="password != null" >
password,
</if>
<if test="classid != null" >
classid,
</if>
<if test="picurl != null" >
picurl,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="stuid != null" >
#{stuid,jdbcType=INTEGER},
</if>
<if test="stunum != null" >
#{stunum,jdbcType=CHAR},
</if>
<if test="stuname != null" >
#{stuname,jdbcType=VARCHAR},
</if>
<if test="password != null" >
#{password,jdbcType=VARCHAR},
</if>
<if test="classid != null" >
#{classid,jdbcType=INTEGER},
</if>
<if test="picurl != null" >
#{picurl,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.neuedu.po.TbStudent" >
update tb_student
<set >
<if test="stunum != null" >
stunum = #{stunum,jdbcType=CHAR},
</if>
<if test="stuname != null" >
stuname = #{stuname,jdbcType=VARCHAR},
</if>
<if test="password != null" >
password = #{password,jdbcType=VARCHAR},
</if>
<if test="classid != null" >
classid = #{classid,jdbcType=INTEGER},
</if>
<if test="picurl != null" >
picurl = #{picurl,jdbcType=VARCHAR},
</if>
</set>
where stuid = #{stuid,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.neuedu.po.TbStudent" >
update tb_student
set stunum = #{stunum,jdbcType=CHAR},
stuname = #{stuname,jdbcType=VARCHAR},
password = #{password,jdbcType=VARCHAR},
classid = #{classid,jdbcType=INTEGER},
picurl = #{picurl,jdbcType=VARCHAR}
where stuid = #{stuid,jdbcType=INTEGER}
</update>
</mapper>
接口:
SelectionMapper.java
package com.neuedu.mapper;
import com.neuedu.po.Selection;
public interface SelectionMapper {
int deleteByPrimaryKey(Integer selid);
int insert(Selection record);
int insertSelective(Selection record);
Selection selectByPrimaryKey(Integer selid);
int updateByPrimaryKeySelective(Selection record);
int updateByPrimaryKey(Selection record);
}
TbAdminMapper.java
package com.neuedu.mapper;
import com.neuedu.po.TbAdmin;
public interface TbAdminMapper {
int deleteByPrimaryKey(Integer adminid);
int insert(TbAdmin record);
int insertSelective(TbAdmin record);
TbAdmin selectByPrimaryKey(Integer adminid);
int updateByPrimaryKeySelective(TbAdmin record);
int updateByPrimaryKey(TbAdmin record);
}
TbClassMapper.java
package com.neuedu.mapper;
import com.neuedu.po.TbClass;
public interface TbClassMapper {
int deleteByPrimaryKey(Integer classid);
int insert(TbClass record);
int insertSelective(TbClass record);
TbClass selectByPrimaryKey(Integer classid);
int updateByPrimaryKeySelective(TbClass record);
int updateByPrimaryKey(TbClass record);
}
TbCourseMapper.java
package com.neuedu.mapper;
import com.neuedu.po.TbCourse;
public interface TbCourseMapper {
int deleteByPrimaryKey(Integer courseid);
int insert(TbCourse record);
int insertSelective(TbCourse record);
TbCourse selectByPrimaryKey(Integer courseid);
int updateByPrimaryKeySelective(TbCourse record);
int updateByPrimaryKey(TbCourse record);
}
TbStudentMapper.java
package com.neuedu.mapper;
import com.neuedu.po.TbStudent;
public interface TbStudentMapper {
int deleteByPrimaryKey(Integer stuid);
int insert(TbStudent record);
int insertSelective(TbStudent record);
TbStudent selectByPrimaryKey(Integer stuid);
int updateByPrimaryKeySelective(TbStudent record);
int updateByPrimaryKey(TbStudent record);
}
AdminService.java
package com.neuedu.service;
public interface AdminService {
public boolean login(String username,String password);
}
java文件:
Selection.java
package com.neuedu.po;
public class Selection {
private Integer selid;
private Integer stuid;
private Integer courseid;
private Integer year;
private String term;
private Double grade;
public Integer getSelid() {
return selid;
}
public void setSelid(Integer selid) {
this.selid = selid;
}
public Integer getStuid() {
return stuid;
}
public void setStuid(Integer stuid) {
this.stuid = stuid;
}
public Integer getCourseid() {
return courseid;
}
public void setCourseid(Integer courseid) {
this.courseid = courseid;
}
public Integer getYear() {
return year;
}
public void setYear(Integer year) {
this.year = year;
}
public String getTerm() {
return term;
}
public void setTerm(String term) {
this.term = term == null ? null : term.trim();
}
public Double getGrade() {
return grade;
}
public void setGrade(Double grade) {
this.grade = grade;
}
}
TbAdmin.java
package com.neuedu.po;
public class TbAdmin {
private Integer adminid;
private String username;
private String password;
public Integer getAdminid() {
return adminid;
}
public void setAdminid(Integer adminid) {
this.adminid = adminid;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username == null ? null : username.trim();
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password == null ? null : password.trim();
}
}
TbClass.java
package com.neuedu.po;
public class TbClass {
private Integer classid;
private String classname;
public Integer getClassid() {
return classid;
}
public void setClassid(Integer classid) {
this.classid = classid;
}
public String getClassname() {
return classname;
}
public void setClassname(String classname) {
this.classname = classname == null ? null : classname.trim();
}
}
TbCourse.java
package com.neuedu.po;
public class TbCourse {
private Integer courseid;
private String coursename;
private Integer hour;
private Double score;
private String picurl;
public Integer getCourseid() {
return courseid;
}
public void setCourseid(Integer courseid) {
this.courseid = courseid;
}
public String getCoursename() {
return coursename;
}
public void setCoursename(String coursename) {
this.coursename = coursename == null ? null : coursename.trim();
}
public Integer getHour() {
return hour;
}
public void setHour(Integer hour) {
this.hour = hour;
}
public Double getScore() {
return score;
}
public void setScore(Double score) {
this.score = score;
}
public String getPicurl() {
return picurl;
}
public void setPicurl(String picurl) {
this.picurl = picurl == null ? null : picurl.trim();
}
}
TbStudent.java
package com.neuedu.po;
public class TbStudent {
private Integer stuid;
private String stunum;
private String stuname;
private String password;
private Integer classid;
private String picurl;
public Integer getStuid() {
return stuid;
}
public void setStuid(Integer stuid) {
this.stuid = stuid;
}
public String getStunum() {
return stunum;
}
public void setStunum(String stunum) {
this.stunum = stunum == null ? null : stunum.trim();
}
public String getStuname() {
return stuname;
}
public void setStuname(String stuname) {
this.stuname = stuname == null ? null : stuname.trim();
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password == null ? null : password.trim();
}
public Integer getClassid() {
return classid;
}
public void setClassid(Integer classid) {
this.classid = classid;
}
public String getPicurl() {
return picurl;
}
public void setPicurl(String picurl) {
this.picurl = picurl == null ? null : picurl.trim();
}
}
AdminServiceImpl.java
package com.neuedu.service.impl;
import org.springframework.stereotype.Service;
import com.neuedu.service.AdminService;
@Service
public class AdminServiceImpl implements AdminService {
@Override
public boolean login(String username, String password) {
return false;
}
}
页面文件
login.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>管理员登陆页面</title>
<link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/css/htmleaf-demo.css">
<link href="${pageContext.request.contextPath}/static/css/signin.css" rel="stylesheet">
</head>
<body>
<div class="htmleaf-container">
<div class="signin">
<div class="signin-head"><img src="${pageContext.request.contextPath}/static/images/test/head_120.png" alt="" class="img-circle"></div>
<form class="form-signin" role="form" action="${pageContext.request.contextPath}/login/login" method="post">
<input name="username" type="text" class="form-control" placeholder="用户名" required autofocus />
<input name="password" type="password" class="form-control" placeholder="密码" required />
<button class="btn btn-lg btn-warning btn-block" type="submit">登录</button>
<label class="checkbox">
<input type="checkbox" value="remember-me"> 记住我
</label>
</form>
</div>
</div>
</body>
</html>
输出: