一、源码:
1、Users.java
package com.login.entity;import java.io.Serializable;public class Users implements Serializable { /** * */ private static final long serialVersionUID = 1L; private Integer id; private String username; private String password; public Users() { super(); } public Users(Integer id, String username, String password) { super(); this.id = id; this.username = username; this.password = password; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } }
2、UsersController.java
package com.login.controller;import java.util.HashMap;import javax.annotation.Resource;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpSession;import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;import org.apache.ibatis.annotations.Param;import org.springframework.stereotype.Controller;import org.springframework.ui.Model;import org.springframework.web.bind.annotation.RequestMapping;import com.login.entity.Users;import com.login.service.UsersService;import com.login.util.MD5Util;@[email protected]("/")public class UsersController { protected final Log logger = LogFactory.getLog(getClass()); @Resource private UsersService usersService; @RequestMapping("main") public String main() { return "main"; } @RequestMapping("login") public String login() { return "login"; /*HashMap<String, Object> users = new HashMap<String, Object>(); users.put("username",username.trim()); users.put("password",MD5Util.string2MD5(password.trim())); Users one=usersService.getUserByUsernameAndPassword(users); HttpSession session = request.getSession(); session.setAttribute("one",one); if(one==null){ model.addAttribute("error","用户名或密码错误!"); return "login"; }else{ return "redirect:/main"; }*/ } @RequestMapping("adminis") public String adminis(@Param("username") String username,@Param("password") String password,HttpServletRequest request,Model model) { HttpSession session = request.getSession(); session.setAttribute("username",username); session.setAttribute("password",password); if(username==null||username==""){ model.addAttribute("error","用户名不能为空!"); return "login"; }else if(password==null||password==""){ model.addAttribute("error","密码不能为空!"); return "logins"; } HashMap<String, Object> users = new HashMap<String, Object>(); users.put("username",username.trim()); users.put("password",MD5Util.string2MD5(password.trim())); Users user=usersService.getUserByUsernameAndPassword(users); session.setAttribute("user",user); if(user==null){ model.addAttribute("error","用户名或密码错误!"); return "logins"; }else{ return "redirect:/admin"; } } @RequestMapping("admin") public String admin() { return "main"; } @RequestMapping("logout") public String logout(HttpServletRequest request) { request.getSession().removeAttribute("user"); request.getSession().invalidate(); return "login"; } }
3、UsersService.java
package com.login.service;import java.util.ArrayList;import java.util.Map;import com.login.entity.Users;public interface UsersService { /** * 添加用户信息 * @param param */ public void insertUsers(Map<String, Object> param); /** * 删除用户信息 * @param id */ public void deleteUsers(int id); /** * 修改用户信息 * @param param */ public void updateUsers(Map<String, Object> param); /** * 查询用户信息(后台) * @return List<Users> */ public ArrayList<Users> searchUsers(); /** * 根据用户名称查询用户信息(后台) * @return List<Users> */ public ArrayList<Users> searchUsersByUsername(String username); /** * 根据编号查询用户信息 * @param id * @return Users */ public Users searchUsersById(int id); /** * 根据用户名和密码查询用户是否存在 * @param param * @return Users */ public Users getUserByUsernameAndPassword(Map<String, Object> param); }
4、UsersServiceImpl.java
package com.login.service.impl;import java.util.ArrayList;import java.util.Map;import javax.annotation.Resource;import org.springframework.stereotype.Service;import org.springframework.transaction.annotation.Transactional;import com.login.entity.Users;import com.login.mapper.UsersMapper;import com.login.service.UsersService;@[email protected]// @Transactional表示该类被Spring作为管理事务的类public class UsersServiceImpl implements UsersService { @Resource private UsersMapper usersMapper; /** * 添加用户信息 * * @param param */ @Override public void insertUsers(Map<String, Object> param) { usersMapper.insertUsers(param); } /** * 删除用户信息 * * @param id */ @Override public void deleteUsers(int id) { usersMapper.deleteUsers(id); } /** * 修改用户信息 * * @param param */ @Override public void updateUsers(Map<String, Object> param) { usersMapper.updateUsers(param); } /** * 查询用户信息(后台) * * @return List<Users> */ @Override public ArrayList<Users> searchUsers() { return usersMapper.searchUsers(); } /** * 根据用户名称查询用户信息(后台) * * @return List<Users> */ @Override public ArrayList<Users> searchUsersByUsername(String username) { return usersMapper.searchUsersByUsername(username); } /** * 根据编号查询用户信息 * * @param id * @return Users */ @Override public Users searchUsersById(int id) { return usersMapper.searchUsersById(id); } /** * 根据用户名和密码查询用户是否存在 * * @param param * @return Users */ public Users getUserByUsernameAndPassword(Map<String, Object> param) { return usersMapper.getUserByUsernameAndPassword(param); } }
5、UsersMapper.java
package com.login.mapper;import java.util.ArrayList;import java.util.Map;import com.login.entity.Users;public interface UsersMapper { /** * 添加用户信息 * * @param param */ public void insertUsers(Map<String, Object> param); /** * 删除用户信息 * * @param id */ public void deleteUsers(int id); /** * 修改用户信息 * * @param param */ public void updateUsers(Map<String, Object> param); /** * 查询用户信息(后台) * * @return ArrayList<Users> */ public ArrayList<Users> searchUsers(); /** * 根据用户名称查询用户信息(后台) * * @return ArrayList<Users> */ public ArrayList<Users> searchUsersByUsername(String username); /** * 根据编号查询用户信息 * * @param id * @return Users */ public Users searchUsersById(int id); /** * 根据用户名和密码查询用户是否存在 * * @param param * @return Users */ public Users getUserByUsernameAndPassword(Map<String, Object> param); }
6、UsersMapper.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.login.mapper.UsersMapper"> <insert id="insertUsers" parameterType="java.util.Map"> INSERT INTO tbl_Users ([username],[password]) VALUES (#{username},#{password}) <selectKey keyProperty="id" resultType="int" order="AFTER"> select @@identity </selectKey> </insert> <select id="deleteUsers" parameterType="java.lang.Integer"> delete from tbl_Users where id = #{id} </select> <update id="updateUsers" parameterType="com.login.entity.Users" statementType="PREPARED"> update tbl_Users <set> <if test="username != null">username = #{username},</if> <if test="password != null">password = #{password},</if> </set> where id = #{id} </update> <select id="searchUsers" parameterType="java.util.Map" resultType="com.login.entity.Users"> select * from tbl_Users </select> <select id="searchUsersByUsername" parameterType="java.lang.String" resultType="com.login.entity.Users"> select * from tbl_Users where username like ‘%${_parameter}%‘ </select> <select id="searchUsersById" parameterType="java.lang.Integer" resultType="com.login.entity.Users"> select * from tbl_Users where id = #{id} </select> <select id="getUserByUsernameAndPassword" parameterType="java.util.Map" resultType="com.login.entity.Users"> select * from tbl_Users where username=#{username} and password=#{password} </select></mapper>
7、jdbc.properties
jdbc_driver=com.microsoft.sqlserver.jdbc.SQLServerDriverjdbc_url=jdbc:sqlserver://127.0.0.1:1433;DatabaseName=policestationjdbc_username=sajdbc_password=systemadmin
7、applicationContext.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:p="http://www.springframework.org/schema/p" 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-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <!-- 引入jdbc配置文件 --> <context:property-placeholder location="config/jdbc.properties" /> <!--配制数据源--> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName" value="${jdbc_driver}"></property> <property name="url" value="${jdbc_url}"></property> <property name="username" value="${jdbc_username}"></property> <property name="password" value="${jdbc_password}"></property> </bean> <!-- 创建sqlSessionFactory,同时指定数据源 --> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="dataSource" ref="dataSource"></property> <property name="configLocation" value="/WEB-INF/mybatis-config.xml"/> <!-- 自动扫描mapper目录, 省掉mybatis-config.xml里的手工配置 --> <property name="mapperLocations"> <list> <value>classpath:com/login/mapper/*.xml</value> </list> </property> </bean> <!-- 通过扫描的模式,扫描目录在com/login/mapper目录下 --> <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <property name="basePackage" value="com.login.mapper" /> <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" /> </bean> <!-- (事务管理)--> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource"></property> </bean> <!-- 使用annotation定义数据库事务,这样可以在类或方法中直接使用@Transactional注解来声明事务 --> <tx:annotation-driven transaction-manager="transactionManager" /> <tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="insert*" propagation="REQUIRED" /> <tx:method name="delete*" propagation="REQUIRED" /> <tx:method name="update*" propagation="REQUIRED" /> <tx:method name="approve" propagation="REQUIRED" /> <tx:method name="undo" propagation="REQUIRED" /> <tx:method name="load*" propagation="SUPPORTS" read-only="true" /> <tx:method name="get*" propagation="SUPPORTS" read-only="true" /> <tx:method name="search*" propagation="SUPPORTS" read-only="true" /> <tx:method name="*" propagation="SUPPORTS" read-only="true" /> </tx:attributes> </tx:advice> <aop:config> <aop:pointcut id="serviceMethod" expression="execution(* com.login.service.*.*(..))" /> <aop:advisor advice-ref="txAdvice" pointcut-ref="serviceMethod" /> </aop:config> <!-- 自动搜索注解路径--> <context:component-scan base-package="com.login"></context:component-scan></beans>
8、mybatis-config.xml
<?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> <!--整合Spring的时候 只有 settings typeAliases mapper 三个属性有用, 其余的要在spring总配置文件中会覆盖 --> <settings> <!-- 全局映射器,是否启用缓存 --> <setting name="cacheEnabled" value="false" /> <!-- 查询时,关闭关联对象即时加载以提高性能 --> <!-- 设置关联对象加载的形态,此处为按需加载字段(加载字段由SQL指 定),不会加载关联表的所有字段,以提高性能 --> <setting name="aggressiveLazyLoading" value="false" /> <!-- 对于未知的SQL查询,允许返回不同的结果集以达到通用的效果 --> <setting name="multipleResultSetsEnabled" value="true" /> <!-- 允许使用列标签代替列名 --> <setting name="useColumnLabel" value="true" /> <!-- 允许使用自定义的主键值(比如由程序生成的UUID 32位编码作为键值),数据表的PK生成策略将被覆盖 --> <setting name="useGeneratedKeys" value="true" /> <!-- 给予被嵌套的resultMap以字段-属性的映射支持 --> <setting name="autoMappingBehavior" value="FULL" /> <!-- 对于批量更新操作缓存SQL以提高性能 --> <setting name="defaultExecutorType" value="BATCH" /> <!-- 数据库超过25000秒仍未响应则超时 --> <setting name="defaultStatementTimeout" value="25000" /> </settings> </configuration>
9、spring-servlet.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:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd"> <!-- 自动扫描的包名 --> <context:component-scan base-package="com.login.controller"/> <!-- 默认的注解映射的支持 --> <mvc:annotation-driven /> <!-- 静态资源映射 --> <mvc:resources mapping="/css/**" location="/WEB-INF/view/css/" cache-period="31556926"/> <mvc:resources mapping="/images/**" location="/WEB-INF/view/images/" cache-period="31556926"/> <mvc:resources mapping="/img/**" location="/WEB-INF/view/img/" cache-period="31556926"/> <mvc:resources mapping="/js/**" location="/WEB-INF/view/js/" cache-period="31556926"/> <mvc:resources mapping="/m_css/**" location="/WEB-INF/view/manager/css/" cache-period="31556926"/> <mvc:resources mapping="/m_images/**" location="/WEB-INF/view/manager/images/" cache-period="31556926"/> <mvc:resources mapping="/datePicker/**" location="/WEB-INF/view/manager/My97DatePicker/" cache-period="31556926"/> <mvc:resources mapping="/dtree/**" location="/WEB-INF/view/dtree/" cache-period="31556926"/> <mvc:resources mapping="/ztree/**" location="/WEB-INF/view/zTree_v3/" cache-period="31556926"/> <mvc:resources mapping="/FCKeditor/**" location="/FCKeditor/" cache-period="31556926"/> <mvc:resources mapping="/UserFiles/**" location="/UserFiles/" cache-period="31556926"/> <mvc:resources mapping="/upload/**" location="/upload/" cache-period="31556926"/> <mvc:resources mapping="/uploadFriendly/**" location="/uploadFriendly/" cache-period="31556926"/> <mvc:resources mapping="/uploadAdvert/**" location="/uploadAdvert/" cache-period="31556926"/> <mvc:resources mapping="/uploadNotice/**" location="/uploadNotice/" cache-period="31556926"/> <mvc:resources mapping="/tool/**" location="/tool/" cache-period="31556926"/> <mvc:resources mapping="/loginImg/**" location="/WEB-INF/view/manager/login/images/" cache-period="31556926"/> <!-- 对模型视图添加前后缀 --> <bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver"> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView" /> <property name="prefix" value="/" /> <property name="suffix" value=".jsp" /> </bean> <!-- file upload --> <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> <property name="maxUploadSize" value="-1" /><!-- 字节单位 --> <property name="maxInMemorySize" value="2048" /><!-- 2M --> <property name="defaultEncoding" value="UTF-8" /> </bean></beans>
10、web.xml
<?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>错误跳转页面</display-name> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <display-name>session销毁时间(分钟)</display-name> <session-config> <session-timeout>30</session-timeout> </session-config> <listener> <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class> </listener> <servlet> <servlet-name>spring</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <servlet-mapping> <servlet-name>spring</servlet-name> <url-pattern>*.html</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>spring</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <display-name>Spring字符集过滤器</display-name> <filter> <filter-name>encoding</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> <init-param> <param-name>forceEncoding</param-name> <param-value>true</param-value> </init-param> </filter> <filter-mapping> <filter-name>encoding</filter-name> <url-pattern>/*</url-pattern> </filter-mapping></web-app>
11、index.jsp
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%><% 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> This is my JSP page. <br> <a href="login.html">管理登录</a> </body></html>
12、login.jsp
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%><%@ page import="com.login.entity.Users"%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>用户登录</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><style>body{margin:0; padding:0; font-size:9pt;}#login{margin:auto; width:975px; height:368px; margin-top:120px;}#top_left{width:691px; height:89px; float:left;}#top_left img {margin-left:33px;}#top_center{width:248px; height:89px; background:url(loginImg/login_05.gif); float:left;}#center_left{width:691px; height:190px; background:url(loginImg/login_09.jpg); float:left;}#center_middle{width:248px; height:190px; float:left; background:url(loginImg/login_13.gif) repeat-y;}#center_right{width:36px; height:190px; float:right; background:url(loginImg/login_11.gif);}#down_left{width:691px; height:89px; float:left; margin-top:15px;}#down_center{width:248px; height:89px; background:url(loginImg/login_16.gif); float:left;}#inf{width:691px; height:38px; background:url(loginImg/login_18.gif) no-repeat; }.inf_text{display:block; width:100px; height:20px; font-size:16px; font-weight:bolder; color:#fff; margin-left:17px; margin-top:12px; float:left;}.copyright{display:block; float:left; margin-left:17px; margin-top:15px;}#message{text-align:center;color:red;}#user{ margin-left:40px; margin-top:15px;}#password{margin-left:40px; margin-top:25px; height:25px;}input{width:120px; height:18px; border:solid 1px #aca7a7; font-size:9pt;}#btn{margin-left:30px; margin-top:40px;height:25px; margin-right:28px; text-align:center;}#btn a{display:block; line-height:25px; background: url(loginImg/bt_bg.gif); border: solid 1px #b6b6b6; width:65px; float:left; margin-left:15px; text-decoration:none; color:#000;}#btn input{display:block;height:25px; line-height:22px; background: url(loginImg/bt_bg.gif); border: solid 1px #b6b6b6; width:65px; float:left; margin-left:2px; text-decoration:none; color:#000;}</style><script type="text/javascript">function show(){ if(document.getElementById("name").value==""){ document.getElementById("showname").innerHTML="用户名不能为空!"; document.getElementById("name").focus(); return false; }else if(document.getElementById("pwd").value==""){ document.getElementById("showname").innerHTML="密码不能为空!"; document.getElementById("pwd").focus(); return false; }else{ return true; }</script></head><body> <form action="adminis.html" method="post" name="myform"> <div id="login"> <div id="top"> <div id="top_left"><img src="loginImg/login_03.gif"/></div> <div id="top_center"></div> </div> <div id="center"> <div id="center_left"></div> <div id="center_middle"> <div id="message">${error}<span id="showname" style="display:inline;"></span></div> <div id="user">用 户:<input type="text" name="username" onblur="show()" id="name"/></div> <div id="password">密 码:<input type="password" name="password" onblur="show()" id="pwd"/></div> <div id="btn"><a href="javascript:document.myform.submit();">登 录</a><a href="javascript:document.myform.reset();">清 空</a></div> </div> <div id="center_right"></div> </div> <div id="down"> <div id="down_left"> <div id="inf"><span class="inf_text">版本信息</span><span class="copyright">信息管理系统 2015 v1.0</span><span class="copyright" style="color:red;">请在IE10以下版本中使用后台功能</span></div> </div> <div id="down_center"></div> </div> </div> </form></body></html>
13、logins.jsp
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%><%@ page import="com.login.entity.Users"%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>用户登录</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><style>body{margin:0; padding:0; font-size:9pt;}#login{margin:auto; width:975px; height:368px; margin-top:120px;}#top_left{width:691px; height:89px; float:left;}#top_left img {margin-left:33px;}#top_center{width:248px; height:89px; background:url(loginImg/login_05.gif); float:left;}#center_left{width:691px; height:190px; background:url(loginImg/login_09.jpg); float:left;}#center_middle{width:248px; height:190px; float:left; background:url(loginImg/login_13.gif) repeat-y;}#center_right{width:36px; height:190px; float:right; background:url(loginImg/login_11.gif);}#down_left{width:691px; height:89px; float:left; margin-top:15px;}#down_center{width:248px; height:89px; background:url(loginImg/login_16.gif); float:left;}#inf{width:691px; height:38px; background:url(loginImg/login_18.gif) no-repeat; }.inf_text{display:block; width:100px; height:20px; font-size:16px; font-weight:bolder; color:#fff; margin-left:17px; margin-top:12px; float:left;}.copyright{display:block; float:left; margin-left:17px; margin-top:15px;}#message{text-align:center;color:red;}#user{ margin-left:40px; margin-top:15px;}#password{margin-left:40px; margin-top:25px; height:25px;}input{width:120px; height:18px; border:solid 1px #aca7a7; font-size:9pt;}#btn{margin-left:30px; margin-top:40px;height:25px; margin-right:28px; text-align:center;}#btn a{display:block; line-height:25px; background: url(loginImg/bt_bg.gif); border: solid 1px #b6b6b6; width:65px; float:left; margin-left:15px; text-decoration:none; color:#000;}#btn input{display:block;height:25px; line-height:22px; background: url(loginImg/bt_bg.gif); border: solid 1px #b6b6b6; width:65px; float:left; margin-left:2px; text-decoration:none; color:#000;}</style><script type="text/javascript">function show(){ if(document.getElementById("name").value==""){ document.getElementById("showname").innerHTML="用户名不能为空!"; document.getElementById("name").focus(); return false; }else if(document.getElementById("pwd").value==""){ document.getElementById("showname").innerHTML="密码不能为空!"; document.getElementById("pwd").focus(); return false; }else{ return true; } </script></head><body> <form action="adminis.html" method="post" name="myform"> <div id="login"> <div id="top"> <div id="top_left"><img src="loginImg/login_03.gif"/></div> <div id="top_center"></div> </div> <div id="center"> <div id="center_left"></div> <div id="center_middle"> <div id="message">${error}<span id="showname" style="display:inline;"></span></div> <div id="user">用 户:<input type="text" name="username" value="<%=(String)session.getAttribute("username") %>" onblur="show()" id="name"/></div> <div id="password">密 码:<input type="password" name="password" value="<%=(String)session.getAttribute("password") %>" onblur="show()" id="pwd"/></div> <div id="btn"><a href="javascript:document.myform.submit();">登 录</a><a href="login.html">清 空</a></div> </div> <div id="center_right"></div> </div> <div id="down"> <div id="down_left"> <div id="inf"><span class="inf_text">版本信息</span><span class="copyright">信息管理系统 2015 v1.0</span><span class="copyright" style="color:red;">请在IE10以下版本中使用后台功能</span></div> </div> <div id="down_center"></div> </div> </div> </form></body></html>
14、main.jsp
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%><%@ page import="com.login.entity.Users"%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><% Users user=(Users)session.getAttribute("user"); %> <head> <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> 欢迎您<%=user.getUsername() %> </body></html>
二、lib下项目支持的驱动包(以下是需要的jar包,文件太大,无法上传请看图片,按照下面的版本下载就可以。)
三、需要的数据库文件可自行设计建库。
1. 使用阿里巴巴Druid连接池(高效、功能强大、可扩展性好的数据库连接池、监控数据库访问性能、支持Common-Logging、Log4j和JdkLog,监控数据库访问)
2. 提供高并发JMS消息处理机制
3. 所有功能模块化、所有模块服务化、所有服务原子化的方式,提供可拓展的服务模型,使程序稳定运行,永不宕机
4. 提供Wink Rest、Webservice服务,故可作为独立服务平台部署
框架整合:
Springmvc + Mybatis + Shiro(权限) + REST(服务) + WebService(服务) + JMS(消息) + Lucene(搜搜引擎) + Quartz(定时调度) + Bootstrap Html5(支持PC、IOS、Android)
框架简介:
项目Maven构建,真实大型互联网架构,做到高并发,大数据处理,整个项目使用定制化服务思想,提供模块化、服务化、原子化的方案,将功能模块进行拆分,可以公用到所有的项目中。架构采用分布式部署架构,所有模块进行拆分,使项目做到绝对解耦,稳定压倒一切~~
持续集成:
1. 我的待办工作流服务(提供Webservice服务)
2. 我的待办工作流集成JMS消息服务(支持高并发,可支持成千上万系统集成)
3. 我的任务提供Rest服务,完成日常的工作管理,通过定时调度平台,动态生成我的任务、循环周期任务、定时邮催提醒完成任务等
4. 文件上传、多线程下载服务化、发送邮件、短信服务化、部门信息服务化、产品信息服务化、信息发布服务化、我的订阅服务化、我的任务服务化、公共链接、我的收藏服务化等
系统模块:
1. 用户管理:
用户信息管理(添加、删除、修改、用户授权、用户栏目管理、查询等)
用户组管理(添加、删除、修改、用户组栏目授权,栏目授权、查询、用户组人员添加查询等)
用户角色管理(添加、删除、修改、用户角色授权、用户角色栏目信息查询设置等)
2. 文章管理:
栏目管理:查询无限极栏目树、创建无限极栏目树分类(导航栏目、图片列表栏目、文章列表栏目、文章内容栏目等)、删除、修改栏目信息。
文章管理:创建、删除、修改文章,多维度文章查询,包括已发布、未发布、所有文章等。文章富文本编辑器、文章多文件上传、文章状态控制等。
3. 系统设置:
数据字典管理:支持中、英文信息,支持无限级别分类配置,动态控制是否可用等。
部门信息管理:支持中、英文无限级别部门信息增加,删除,修改操作,部门列表、树心查询等。
日志管理:系统日志列表查询、在线查看、在线下载等
路线管理:集成百度地图API,提供线路查询管理功能
Druid Monitor(监控):集成阿里巴巴连接池,提供在线连接池监控程序,包括:数据源、SQL监控、URL监控、Session监控、Spring监控等
网站信息管理:通过系统配置文件进行网站内容操作,包括邮件服务器配置、公司基本信息配置等。
4. 集成REST服务,可以用作独立服务平台(提供大量实例及测试平台,包括:文件上传下载、邮件短信发送、部门、产品、公共连接、我的收藏、我的任务、信息发布等)
5. 集成Quartz调度,可以用作定时调度平台(动态配置调度类、调度时间,使程序自动执行某些业务)
6. Lucene搜索引擎,可以将文件资料索引化,支持文件内容搜索、关键字搜索、高亮关键字等,使信息在毫秒内提取查询出来
7. 用户设置功能:包括修改用户信息,修改密码、发送消息,修改个人图片,查看角色、查看用户组,管理员修改角色、用户、用户组等。
8. 集成Webservice平台,包括jaxws服务、CXF框架,配置双加密的权限认证。使服务集成更加安全。
9. Bootstrap html5提供了两套前台开环境,包括CMS和电子商务网站,使您的开发更加的简洁。
技术点:
1. Springmvc + Mybatis集成、SpringSecurity权限控制、Spring AOP事务处理。
2. Wink Rest服务、Webservice服务:jaxws、CXF等
3. IO 流上传下载文件,多线程操作
4. 发送邮件,配置邮件服务器,发基于html、纯文本格式的邮件
5. MD5加密 (登陆密码校验加密等),用户统一Session、Cookie管理,统一验证码校验等。
6. 数据库连接池统一配置
7. Quartz定时调度任务集成(直接通过配置即可)
8. Httpclient破解验证码,登陆联通充值平台
9. 汉字、英文拆分、可以用作文档关键字搜索等。
10. Base64图片处理,支持PC,Android,IOS
11. Service Socket 、Client Socket 通信技术(已经做过GPRS数据获取,并用到了项目中)
12. 提供大量工具类,可以直接使用
13. Maven项目构建,您可以直接做架构,可以提升自己的学习能力,使您成为真正的架构师。