一:添加三框架jar包

二:model层(student.java)

Java代码  
  1. package com.wdpc.ss2h.model;
  2. public class Student {
  3. private String id;
  4. private String userName;//创建姓名
  5. private String userPwd;//创建密码
  6. //无参构造
  7. public Student() {
  8. super();
  9. }
  10. //有参构造
  11. public Student(String userName, String userPwd) {
  12. super();
  13. this.userName = userName;
  14. this.userPwd = userPwd;
  15. }
  16. //get,set方法
  17. public String getId() {
  18. return id;
  19. }
  20. public void setId(String id) {
  21. this.id = id;
  22. }
  23. public String getUserName() {
  24. return userName;
  25. }
  26. public void setUserName(String userName) {
  27. this.userName = userName;
  28. }
  29. public String getUserPwd() {
  30. return userPwd;
  31. }
  32. public void setUserPwd(String userPwd) {
  33. this.userPwd = userPwd;
  34. }
  35. }

//model层 student配置文件(Student.hbm.xml)

Java代码  
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
  3. "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
  4. <hibernate-mapping>
  5. <class name="com.wdpc.ss2h.model.Student" table="student">
  6. <id name="id" type="java.lang.String" column="id">
  7. <generator class="uuid.hex"></generator>
  8. </id>
  9. <property name="userName" type="java.lang.String" column="userName" />
  10. <property name="userPwd" type="java.lang.String" column="userPwd" />
  11. </class>
  12. </hibernate-mapping>

此映射文件要放到model层下,和student类放在一起

//dao层 (StudentDao.java)

Java代码  
  1. package com.wdpc.ss2h.dao;
  2. import com.wdpc.ss2h.model.Student;
  3. public interface StudentDao {
  4. //登录
  5. public Student findName(Student student) throws Exception;
  6. //注册
  7. public void createStudent(Student student) throws Exception;
  8. }

创建dao层接口

//实现dao层(StudentDaoImpl.java)

Java代码  
  1. package com.wdpc.ss2h.dao.impl;
  2. import java.util.List;
  3. import org.hibernate.Query;
  4. import org.hibernate.SessionFactory;
  5. import com.wdpc.ss2h.dao.StudentDao;
  6. import com.wdpc.ss2h.model.Student;
  7. public class StudentDaoImpl implements StudentDao {
  8. private SessionFactory sessionFactory;
  9. //注册
  10. public void createStudent(Student student) throws Exception {
  11. sessionFactory.getCurrentSession().save(student);
  12. }
  13. //登录
  14. public Student findName(Student student) throws Exception {
  15. Query query = sessionFactory.getCurrentSession().createQuery(
  16. "from Student where userName=:name and userPwd=:password");
  17. query.setParameter("name",student.getUserName());
  18. query.setParameter("password",student.getUserPwd());
  19. List<Student> list = query.list();
  20. if (list.size() > 0)
  21. return list.get(0);
  22. else
  23. return null;
  24. }
  25. public void setSessionFactory(SessionFactory sessionFactory) {
  26. this.sessionFactory = sessionFactory;
  27. }
  28. }

实现StudentDao.java接口方法

//service层(StudentService.java)

Java代码  
  1. package com.wdpc.ss2h.service;
  2. import com.wdpc.ss2h.model.Student;
  3. public interface StudentService {
  4. //登录
  5. public Student findName(Student student) throws Exception;
  6. //注册
  7. public void createStudent(Student student) throws Exception;
  8. }

//实现service层(StudentServiceImpl.java)

Java代码  
  1. package com.wdpc.ss2h.service.impl;
  2. import com.wdpc.ss2h.dao.StudentDao;
  3. import com.wdpc.ss2h.model.Student;
  4. import com.wdpc.ss2h.service.StudentService;
  5. public class StudentServiceImpl implements StudentService {
  6. private StudentDao studentDao;
  7. public void createStudent(Student student) throws Exception {
  8. studentDao.createStudent(student);
  9. }
  10. public Student findName(Student student) throws Exception {
  11. return studentDao.findName(student);
  12. }
  13. public void setStudentDao(StudentDao studentDao) {
  14. this.studentDao = studentDao;
  15. }
  16. }

//BaseAction.java

Java代码  
  1. package com.wdpc.ss2h.comms;
  2. import java.util.Map;
  3. import javax.servlet.http.HttpServletRequest;
  4. import javax.servlet.http.HttpServletResponse;
  5. import org.apache.struts2.interceptor.ServletRequestAware;
  6. import org.apache.struts2.interceptor.ServletResponseAware;
  7. import org.apache.struts2.interceptor.SessionAware;
  8. import com.opensymphony.xwork2.ActionSupport;
  9. public abstract class BaseAction extends ActionSupport implements
  10. ServletResponseAware, ServletRequestAware, SessionAware {
  11. protected HttpServletResponse response;
  12. protected HttpServletRequest request;
  13. protected Map<String, Object> session;
  14. public void setServletResponse(HttpServletResponse response) {
  15. this.response = response;
  16. }
  17. public void setServletRequest(HttpServletRequest request) {
  18. this.request = request;
  19. }
  20. public void setSession(Map<String, Object> session) {
  21. this.session = session;
  22. }
  23. public HttpServletResponse getResponse() {
  24. return response;
  25. }
  26. public void setResponse(HttpServletResponse response) {
  27. this.response = response;
  28. }
  29. public HttpServletRequest getRequest() {
  30. return request;
  31. }
  32. public void setRequest(HttpServletRequest request) {
  33. this.request = request;
  34. }
  35. public Map getSession() {
  36. return session;
  37. }
  38. }

//action层 (StudentAction.java)

Java代码  
  1. package com.wdpc.ss2h.action;
  2. import java.awt.Color;
  3. import java.awt.Font;
  4. import java.awt.Graphics;
  5. import java.awt.image.BufferedImage;
  6. import java.io.ByteArrayInputStream;
  7. import java.io.ByteArrayOutputStream;
  8. import java.io.IOException;
  9. import java.io.InputStream;
  10. import java.util.Map;
  11. import java.util.Random;
  12. import javax.imageio.ImageIO;
  13. import com.opensymphony.xwork2.ModelDriven;
  14. import com.wdpc.ss2h.comms.BaseAction;
  15. import com.wdpc.ss2h.model.Student;
  16. import com.wdpc.ss2h.service.StudentService;
  17. public class StudentAction extends BaseAction implements ModelDriven<Student>{
  18. private Student student;
  19. private InputStream imageStream;
  20. private Map<String, Object> session;
  21. private StudentService studentService;
  22. private String randCode;//验证码
  23. private String message;//显示错误信息
  24. public String index(){
  25. return "index";
  26. }
  27. // 验证码
  28. public String getCheckCodeImage(String str, int show,
  29. ByteArrayOutputStream output) {
  30. Random random = new Random();
  31. BufferedImage image = new BufferedImage(80, 30,
  32. BufferedImage.TYPE_3BYTE_BGR);
  33. Font font = new Font("Arial", Font.PLAIN, 24);
  34. int distance = 18;
  35. Graphics d = image.getGraphics();
  36. d.setColor(Color.WHITE);
  37. d.fillRect(0, 0, image.getWidth(), image.getHeight());
  38. d.setColor(new Color(random.nextInt(100) + 100,
  39. random.nextInt(100) + 100, random.nextInt(100) + 100));
  40. for (int i = 0; i < 10; i++) {
  41. d.drawLine(random.nextInt(image.getWidth()), random.nextInt(image
  42. .getHeight()), random.nextInt(image.getWidth()), random
  43. .nextInt(image.getHeight()));
  44. }
  45. d.setColor(Color.BLACK);
  46. d.setFont(font);
  47. String checkCode = "";
  48. char tmp;
  49. int x = -distance;
  50. for (int i = 0; i < show; i++) {
  51. tmp = str.charAt(random.nextInt(str.length() - 1));
  52. checkCode = checkCode + tmp;
  53. x = x + distance;
  54. d.setColor(new Color(random.nextInt(100) + 50,
  55. random.nextInt(100) + 50, random.nextInt(100) + 50));
  56. d.drawString(tmp + "", x, random.nextInt(image.getHeight()
  57. - (font.getSize()))
  58. + (font.getSize()));
  59. }
  60. d.dispose();
  61. try {
  62. ImageIO.write(image, "jpg", output);
  63. } catch (IOException e) {
  64. e.printStackTrace();
  65. }
  66. return checkCode;
  67. }
  68. public String execute() throws Exception {
  69. ByteArrayOutputStream output = new ByteArrayOutputStream();
  70. String checkCode = getCheckCodeImage(
  71. "ABCDEFGHJKLMNPQRSTUVWXYZ123456789", 4, output);
  72. this.session.put("CheckCode", checkCode);
  73. // 这里将output stream转化为 inputstream
  74. this.imageStream = new ByteArrayInputStream(output.toByteArray());
  75. output.close();
  76. return SUCCESS;
  77. }
  78. //登录
  79. public String login(){
  80. String CheckCode = (String)request.getSession().getAttribute("CheckCode");
  81. if(!(CheckCode.equalsIgnoreCase(randCode))){
  82. message ="验证码输入有误!";
  83. return "index";
  84. }
  85. try {
  86. studentService.findName(student);
  87. return "login";
  88. } catch (Exception e) {
  89. e.printStackTrace();
  90. return "index";
  91. }
  92. }
  93. public String register(){
  94. return "register";
  95. }
  96. //注册
  97. public String createStudent(){
  98. try{
  99. studentService.createStudent(student);
  100. return "success";
  101. } catch (Exception e) {
  102. e.printStackTrace();
  103. return "index";
  104. }
  105. }
  106. public Student getStudent() {
  107. return student;
  108. }
  109. public void setStudent(Student student) {
  110. this.student = student;
  111. }
  112. public InputStream getImageStream() {
  113. return imageStream;
  114. }
  115. public void setImageStream(InputStream imageStream) {
  116. this.imageStream = imageStream;
  117. }
  118. public Map<String, Object> getSession() {
  119. return session;
  120. }
  121. public void setSession(Map<String, Object> session) {
  122. this.session = session;
  123. }
  124. public Student getModel() {
  125. student = new Student();
  126. return student;
  127. }
  128. public StudentService getStudentService() {
  129. return studentService;
  130. }
  131. public void setStudentService(StudentService studentService) {
  132. this.studentService = studentService;
  133. }
  134. public String getRandCode() {
  135. return randCode;
  136. }
  137. public void setRandCode(String randCode) {
  138. this.randCode = randCode;
  139. }
  140. public String getMessage() {
  141. return message;
  142. }
  143. public void setMessage(String message) {
  144. this.message = message;
  145. }
  146. }

//StudentAction-createStudent-validation.xml配置注册验证

Java代码  
  1. <!DOCTYPE validators PUBLIC
  2. "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
  3. "http://www.opensymphony.com/xwork/xwork-validator-1.0.3.dtd">
  4. <validators>
  5. <field name="userName">
  6. <field-validator type="requiredstring">
  7. <message>用户名必须填写</message>
  8. </field-validator>
  9. <field-validator type="stringlength">
  10. <param name="minLength">6</param>
  11. <param name="maxLength">12</param>
  12. <message>用户名必须在${minLength}~${maxLength}位之间</message>
  13. </field-validator>
  14. </field>
  15. <field name="userPwd">
  16. <field-validator type="requiredstring">
  17. <param name="trim">true</param>
  18. <message>密码必须填写</message>
  19. </field-validator>
  20. <field-validator type="stringlength">
  21. <param name="minLength">6</param>
  22. <param name="maxLength">20</param>
  23. <message>密码必须在${minLength}~${maxLength}位之间</message>
  24. </field-validator>
  25. </field>
  26. </validators>

此文件放到action层,和StudentAction.java放在一起

//StudentAction-login-validation.xml配置登录验证

Java代码  
  1. <!DOCTYPE validators PUBLIC
  2. "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
  3. "http://www.opensymphony.com/xwork/xwork-validator-1.0.3.dtd">
  4. <validators>
  5. <field name="userName">
  6. <field-validator type="requiredstring">
  7. <message>用户名必须填写</message>
  8. </field-validator>
  9. <field-validator type="stringlength">
  10. <param name="minLength">6</param>
  11. <param name="maxLength">12</param>
  12. <message>用户名必须在${minLength}~${maxLength}位之间</message>
  13. </field-validator>
  14. </field>
  15. <field name="userPwd">
  16. <field-validator type="requiredstring">
  17. <message>请正确填写密码</message>
  18. </field-validator>
  19. <field-validator type="stringlength">
  20. <param name="minLength">6</param>
  21. <param name="maxLength">20</param>
  22. <message>密码必须在${minLength}~${maxLength}位之间</message>
  23. </field-validator>
  24. </field>
  25. </validators>

此文件放到action层,和StudentAction.java放在一起

//配置hibernate.cfg.xml

Java代码  
  1. <?xml version='1.0' encoding='utf-8'?>
  2. <!DOCTYPE hibernate-configuration PUBLIC
  3. "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
  4. "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
  5. <hibernate-configuration>
  6. <session-factory>
  7. <!-- 设置使用数据库的语言 -->
  8. <property name="dialect">org.hibernate.dialect.MySQL5Dialect</property>
  9. <property name="Hibernate.current_session_context_class">thread</property>
  10. <!-- 设置是否显示执行的语言 -->
  11. <property name="show_sql">true</property>
  12. <!--property name="hbm2ddl.auto">create</property-->
  13. <!-- 数据库连接属性设置 -->
  14. <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
  15. <property name="connection.url">jdbc:mysql://localhost:3306/test?useUnicode=true&amp;characterEncoding=utf-8</property>
  16. <property name="connection.username">root</property>
  17. <property name="connection.password">wdpc</property>
  18. <!-- 设置 c3p0连接池的属性-->
  19. <property name="connection.useUnicode">true</property>
  20. <property name="hibernate.c3p0.max_statements">100</property>
  21. <property name="hibernate.c3p0.idle_test_period">3000</property>
  22. <property name="hibernate.c3p0.acquire_increment">2</property>
  23. <property name="hibernate.c3p0.timeout">5000</property>
  24. <property name="hibernate.connection.provider_class">
  25. org.hibernate.connection.C3P0ConnectionProvider
  26. </property>
  27. <property name="hibernate.c3p0.validate">true</property>
  28. <property name="hibernate.c3p0.max_size">3</property>
  29. <property name="hibernate.c3p0.min_size">1</property>
  30. <!-- 加载映射文件-->
  31. <mapping resource="com/wdpc/ss2h/model/Student.hbm.xml" />
  32. </session-factory>
  33. </hibernate-configuration>

此配置文件放在src目录下

//配置struts.xml文件

Java代码  
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE struts PUBLIC
  3. "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
  4. "http://struts.apache.org/dtds/struts-2.0.dtd">
  5. <struts>
  6. <!-- 设置一些全局的常量开关 -->
  7. <constant name="struts.i18n.encoding" value="UTF-8" />
  8. <constant name="struts.action.extension" value="do,action" />
  9. <constant name="struts.serve.static.browserCache " value="false" />
  10. <constant name="struts.configuration.xml.reload" value="true" />
  11. <constant name="struts.devMode" value="true" />
  12. <constant name="struts.enable.DynamicMethodInvocation" value="false" />
  13. <package name="ss2h" extends="struts-default">
  14. <action name="index" class="StudentAction" method="index">
  15. <result name="index">/WEB-INF/page/login.jsp</result>
  16. </action>
  17. <action name="checkCode" class="StudentAction" method="execute">
  18. <result name="success" type="stream">
  19. <param name="contentType">image/jpeg</param>
  20. <param name="contentCharSet">UTF-8</param>
  21. <param name="inputName">imageStream</param>
  22. </result>
  23. </action>
  24. <action name="login" class="StudentAction" method="login">
  25. <result name="login">/WEB-INF/page/success.jsp</result>
  26. <result name="index">/WEB-INF/page/login.jsp</result>
  27. <result name="input">/WEB-INF/page/login.jsp</result>
  28. </action>
  29. <action name="register" class="StudentAction" method="register">
  30. <result name="register">/WEB-INF/page/register.jsp</result>
  31. </action>
  32. <action name="createStudent" class="StudentAction" method="createStudent">
  33. <result name="success">/WEB-INF/page/success.jsp</result>
  34. <result name="index">/WEB-INF/page/register.jsp</result>
  35. <result name="input">/WEB-INF/page/register.jsp</result>
  36. </action>
  37. </package>
  38. </struts>

此配置文件放在src目录下

//配置spring(applicationContext.xml)文件

Java代码  
  1. <beans xmlns="http://www.springframework.org/schema/beans"
  2. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
  3. xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
  4. xsi:schemaLocation="http://www.springframework.org/schema/beans
  5. http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
  6. http://www.springframework.org/schema/context
  7. http://www.springframework.org/schema/context/spring-context-2.5.xsd
  8. http://www.springframework.org/schema/aop
  9. http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
  10. http://www.springframework.org/schema/tx
  11. http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
  12. <context:annotation-config />
  13. <context:component-scan base-package="com.wdpc.ss2h" />
  14. <aop:aspectj-autoproxy />
  15. <bean id="sessionFactory"
  16. class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
  17. <property name="configLocation" value="classpath:hibernate.cfg.xml">
  18. </property>
  19. </bean>
  20. <bean id="studentDao" class="com.wdpc.ss2h.dao.impl.StudentDaoImpl">
  21. <property name="sessionFactory" ref="sessionFactory" />
  22. </bean>
  23. <bean id="studentService" class="com.wdpc.ss2h.service.impl.StudentServiceImpl">
  24. <property name="studentDao" ref="studentDao" />
  25. </bean>
  26. <bean id="StudentAction" class="com.wdpc.ss2h.action.StudentAction" scope="prototype">
  27. <property name="studentService" ref="studentService" />
  28. </bean>
  29. <bean id="txManager"
  30. class="org.springframework.orm.hibernate3.HibernateTransactionManager">
  31. <property name="sessionFactory" ref="sessionFactory" />
  32. </bean>
  33. <tx:annotation-driven transaction-manager="txManager" />
  34. <tx:advice id="txAdvice" transaction-manager="txManager">
  35. <tx:attributes>
  36. <tx:method name="find*" read-only="true"/>
  37. <tx:method name="*" rollback-for="Exception" />
  38. </tx:attributes>
  39. </tx:advice>
  40. <aop:config>
  41. <aop:pointcut id="txPointcut"
  42. expression="execution(* com.wdpc.ss2h.service..*.*(..))" />
  43. <aop:advisor advice-ref="txAdvice" pointcut-ref="txPointcut" />
  44. </aop:config>
  45. </beans>

此配置文件放在src目录下

//配置web.xml

Java代码  
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <web-app version="2.5"
  3. xmlns="http://java.sun.com/xml/ns/javaee"
  4. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  5. xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
  6. http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
  7. <context-param>
  8. <param-name>contextConfigLocation</param-name>
  9. <param-value>classpath:applicationContext.xml</param-value>
  10. </context-param>
  11. <listener>
  12. <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  13. </listener>
  14. <filter>
  15. <filter-name>struts2</filter-name>
  16. <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
  17. </filter>
  18. <filter-mapping>
  19. <filter-name>struts2</filter-name>
  20. <url-pattern>/*</url-pattern>
  21. </filter-mapping>
  22. <welcome-file-list>
  23. <welcome-file>index.jsp</welcome-file>
  24. </welcome-file-list>
  25. </web-app>

//index.jap页面

Java代码  
  1. <%@ page language="java" pageEncoding="utf-8"%>
  2. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
  3. <c:redirect url="/index.do"/>

//login.jsp页面

Java代码  
  1. <%@ page language="java" pageEncoding="utf-8"%>
  2. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
  3. <c:set var="basePath" value="${pageContext.request.contextPath}" />
  4. <%@ taglib uri="/struts-tags" prefix="s"%>
  5. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  6. <html>
  7. <head>
  8. <script type="text/javascript">
  9. function change(obj){
  10. obj.src="${basePath}/checkCode.do?time=" + new Date().getTime();
  11. }
  12. </script>
  13. </head>
  14. <body>
  15. <div>
  16. <form action="${basePath}/login.do" method="post">
  17. <div style="color: red;">
  18. <s:fielderror />
  19. ${message}
  20. </div>
  21. <div>
  22. <label>用户名:</label>
  23. <label><input type="text" name="userName" /></label><br />
  24. <label>密&nbsp;&nbsp;&nbsp;&nbsp;碼:</label>
  25. <label><input type="password" name="userPwd" /></label><br />
  26. <label>验证碼:</label>
  27. <label><input type="text" name="randCode" /></label><br />
  28. <label>&nbsp;&nbsp;&nbsp;&nbsp;<img src="${basePath}/checkCode.do" width="100px"   height="25px" alt="看不清,换一张" style="cursor: pointer;" οnclick="change(this)" /></label>
  29. </div>
  30. <div>
  31. <label><input type="submit" value="登錄" /></label>
  32. <label><input type="button" value="註冊" οnclick="window.location='${basePath}/register.do'"/></label>
  33. </div>
  34. </form>
  35. </div>
  36. </body>
  37. </html>

//register.jsp页面

Java代码  
  1. <%@ page language="java" pageEncoding="utf-8"%>
  2. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
  3. <c:set var="bathPath" value="${pageContext.request.contextPath}"/>
  4. <%@ taglib uri="/struts-tags" prefix="s"%>
  5. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  6. <html>
  7. <head>
  8. </head>
  9. <body>
  10. <div>
  11. <form action="${bathPath}/createStudent.do" method="post">
  12. <div style="color: red;"><s:fielderror /></div>
  13. <div>
  14. <label>用&nbsp;户&nbsp;名:</label>
  15. <input type="text" name="userName"/>
  16. <label id="chage1"></label><br/>
  17. <label>*正确填写用户名,6-12位之间请用英文小写、下划线、数字。</label><br/>
  18. <label>用户密码:</label>
  19. <input type="password" name="userPwd" /><br/>
  20. <label>*正确填写密码,6-12位之间请用英文小写、下划线、数字。</label><br/>
  21. <label>确认密码:</label>
  22. <input type="password" name="pwd2"/><br/>
  23. <label>*两次密码要一致,请用英文小写、下划线、数字。</label><br/>
  24. </div>
  25. <div>
  26. <label><input type="submit" value="註冊" /></label>
  27. <label><input type="reset" value="取消" /></label>
  28. </div>
  29. </form>
  30. </div>
  31. </body>
  32. </html>

//登录和注册成功页面success.jsp

Java代码  
  1. <%@ page language="java" pageEncoding="utf-8"%>
  2. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  3. <html>
  4. <head>
  5. </head>
  6. <body>
  7. 登录成功!
  8. 注册成功!
  9. </body>
  10. </html>

此login.jsp,register.jsp,success.jsp放到/WEB-INF/page目录下:     

登录和注册(struts2+hibernate+spring)相关推荐

  1. 【struts2+hibernate+spring项目实战】实现用户登录功能(ssh)

    一.概述 从今天才开始有时间来总结总结以前自己练习的一些东西,希望总结出来对以后可以更加便捷的来学习,也希望可以帮助到正需要这些东西的同行人,一起学习,共同进步. 二. 登录功能总结 2.1.登录功能 ...

  2. Struts2+Hibernate+Spring 整合示例

    转自:https://blog.csdn.net/tkd03072010/article/details/7468769 Struts2+Hibernate+Spring 整合示例 Spring整合S ...

  3. struts2+hibernate+spring配置详解

    #struts2+hibernate+spring配置详解 struts2+hibernate+spring配置详解 哎 ,当初一个人做好难,现在终于弄好了,希望自学这个的能少走些弯路. 以下是自己配 ...

  4. Struts2 + Hibernate + Spring 以及javaweb模块问题解决(1)

    Struts2 + Hibernate + Spring 以及javaweb模块问题解决 1.资源文件的配置:src文件夹里面要配置,action所在的目录中也要配置. 2.<s: action ...

  5. 关于如何利用Struts2,Hibernate,Spring开发电子商业汇票系统

    关于如何利用Struts2,Hibernate,Spring开发电子商业汇票系统. 首先先说说电子商业汇票的种类: 1.电子银行承兑汇票 2.电子商业承兑汇票 另外电子商业汇票与纸票的区别: 电子商业 ...

  6. 【struts2+hibernate+spring项目实战】java监听器实现权限控制系统和资源获取优化(ssh)

    一.权限控制系统 权限控制系统即用户登录后,如果操作了不能访问的操作,系统将其拦截. 权限控制系统设计需求: 系统功能并不是所有功能都需要被控制,例如登录功能无需校验 设计方案:资源中没有出现的功能将 ...

  7. SSH(Struts2+Hibernate+Spring)开发策略

    很多小伙伴可能一听到框架两个字就会马上摇头,脑子里立刻闪现一个词---"拒绝",其实我也不例外,但我想告诉大家的是,当你真正掌握它时,你会发现**SSH**用起来是那么顺手,因为它 ...

  8. 【struts2+hibernate+spring项目实战】Spring计时器任务 Spring整合JavaMail(邮件发送)(ssh)

    一.常用数据频度维护 对于系统使用度较高的数据,客户在查看时希望这些数据最好先出现,此时需要为其添加排序规则.在进行排序时,使用次数成为排序的依据.因此需要设置一个字段用来描述某种数据的使用次数,也就 ...

  9. 【struts2+hibernate+spring项目实战】数据报表jxl及生成excel(ssh项目实战)

    一.数据报表jxl jxl是一款java读写office--Excel文件的工具.通过java程序进行Excel文件的读写操作. 操作Excel首先应该明确操作过程中java针对Excel文件的对象分 ...

最新文章

  1. 分布式消息通信ActiveMQ原理-持久化策略-笔记
  2. 双眼融合训练一个月_视觉融合你知道多少
  3. Qt学习(四):qt读写文件
  4. http请求curl
  5. HALCON 1D Measure 算子初识
  6. android动画编辑软件,ALM视频动画编辑
  7. 【CodeForces - 334B】Eight Point Sets(水题模拟,有坑)
  8. 2017.3.14 软件包管理器 思考记录
  9. 业务中台管理系统、业务中台架构、接口类服务、模型类服务、界面类服务、组件类服务、服务架构、中后台、服务审核、AI服务、位置服务、行业场景服务、企业中台、接口配置、模型配置、数据处理、结构化数据、数据源
  10. 特征检测和特征匹配方法汇总
  11. .NET与SAP的来往(转)
  12. 安装ESXI 5.5卡在LSI_MR3.V00解决方案
  13. 【转】详解JavaScript中的this指针
  14. 工作流集成表单的过程
  15. deepin启动盘无法引导安装_通过Deepin系统的安装U盘来修复启动引导:可解决大部分启动引导问题...
  16. PHP读取Excel和导出数据至Excel
  17. word字体放大后只显示一半_word字体显示不全或是显示一半怎么回事如何解决
  18. FireFox 插件xpi文件签名2
  19. PLSQL Developer 13.0.0.1883 注册码
  20. 外置硬盘一插就卡_为什么电脑一插移动硬盘就卡死了?

热门文章

  1. 【Android 逆向】GDA 逆向工具安装 ( GDA 下载 | GDA 简介 | 运行 GDA 分析 APK 文件 )
  2. 【Android 应用开发】Canvas 精准绘制文字 ( 文本边界坐标解析 | 绘图位置 )
  3. Maven项目整合讲义(Eclipse版)
  4. bzoj5368 [Pkusc2018]真实排名
  5. java第一节课程笔记、课后习题
  6. 使用nginx缓存服务器上的静态文件
  7. 《毅力-如何培养自律的习惯》读后感
  8. Atitit. 破解  拦截 绕过 网站 手机 短信 验证码  方式 v2 attilax 总结
  9. AC日记——行程长度编码 openjudge 1.7 32
  10. codevs 1958 刺激