Struts2 integrates Hibernate3 for User Login

Source: Internet
Author: User

Technology used: struts2, hibernate, jsp, and mysql. This DEMO only implements the user login function. using MVC, I think it is relatively simple and easy to understand the data flow, by integrating this process, we can clearly see the data flow and design ideas of the entire project. It is the best example for new users to integrate struts2 and hibernate. Now we will integrate the ideas, processes, and code as follows. If the novice still does not understand or needs the source code, I will be happy to help and share the source code. JSP acts as view layer V and displays logon, logon succeeded, and failure pages; Struts2 acts as control layer C processing page Jump; Hibernate is used as Data Model M, it is provided in DAO form with the interface of the foreground program. I. database Design: 1. create Database test table name: user id int not null auto-incrementing username varchar (11) not null password varchar (11 not null) II. m-Layer Development: 2. basic Hibernate configuration: add the relevant jar package of Hibernate for the Web project, hibernate. cfg. xml, and right-click the project file, myeclise, add hibernate... Sessionfacotry will be created, so you don't have to write it yourself, achieving efficient development. Hibernate. cfg. xml: copy the Code <? Xml version = '1. 0' encoding = 'utf-8'?> <! DOCTYPE hibernate-configuration PUBLIC "-// Hibernate/Hibernate Configuration DTD 3.0 // EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <! -- Generated by MyEclipse Hibernate Tools. -->

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.