In this example we are seeing how to develop Registration and Login application using technologies Servlet, JSP, Hibernate Framework and MySQL Database. This application is developed using eclipse IDE. Using Hibernate Framework developer no need to create table in DB, Hibernate framework will take care about creating table. Just developer need to configure DB schema details like username, password, URL (DB TNS entry) and Driver name in the configuration file, named as hibernate.cfg.xml file. and we need to create mapping file with java entity class to Table name and entity properties names to table column names.
i.e, mapping object oriented data to relational data.
Below find the Test Case and flow of the application.
To run the application below Jar file required in lib folder of the application as per the standards of Java Organization.
Below Jar files are available with Hibernate framework. (for more clarification see the previous post: Click Here)
Below Jar files are available with Hibernate framework. (for more clarification see the previous post: Click Here)
- antlr-2.7.7.jar
- cdi-api-1.1.jar
- classmate-1.3.0.jar
- dom4j-1.6.1.jar
- el-api-2.2.jar
- geronimo-jta_1.1_spec-1.1.1.jar
- hibernate-commons-annotations-5.0.1.Final.jar
- hibernate-core-5.2.4.Final.jar
- hibernate-jpa-2.1-api-1.0.0.Final.jar
- jandex-2.0.0.Final.jar
- javassist-3.20.0-GA.jar
- javax.inject-1.jar
- jboss-interceptors-api_1.1_spec-1.0.0.Beta1.jar
- jboss-logging-3.3.0.Final.jar
- jsr250-api-1.0.jar
Below 2 .jar files are available with Tomcat Server (under %Tomcat_Home%/lib folder)
- servlet-api.jar
- jsp-api.jar
Below mysql-connector-java-5.1.37-bin.jar file is available with MySQL instillation (under %MySQL_initialization_location%\Connector.J 5.1\ folder) or available in maven repository.
- mysql-connector-java-5.1.37-bin.jar
Note: MySQL mysql-connector-java-X.X.X-bin.jar version file is different from MySQL version to version.
For developing application using eclipse IDE software, create a Dynamic web project and create the project structure like below screen short.
User.java is the DTO object, means this is the Data Transfer Object between the application layers. from Controller layer to Service layer, Service layer to DAO Layer etc....
User.java
Below .xml file is the configuration file between the Hibernate framework and MySQL DB, based on the below configuration hibernate create a Table in MySQL DB.
User.hbm.xml
hibernate.cfg.xml :
It is an .xml file, in which DB connection details like username, password, url and Driver Class name etc... & hibernate properties like Dialect, show_sql and hbm2ddl.auto etc....
hibernate.cfg.xml You know very well every Java web application must have deployment descriptor configuration for application (either .xml or annotation configuration), below is the web.xml file for our application.
web.xml
In above web.xml file configured welcome file as a login.jsp page and Servlet class with urls login, registration. here Servlet class are controllers for this application. see the below two controllers.
LoginController.java
RegistrationController.java
Below are the Service declaration and Implementation Classes
BaseService.java
BaseServiceImpl.java
Below are the Dao Declaration and Implementation Classes
BaseDao.java
BaseDaoImpl.java
Hibernate Utility Class for Application. Using this class creating Hibernate connection and using this connection in Application Dao Implementation class
HibernateUtil.java
login.jsp
userRegistration.jsp
home.jsp
User.java is the DTO object, means this is the Data Transfer Object between the application layers. from Controller layer to Service layer, Service layer to DAO Layer etc....
User.java
Below .xml file is the configuration file between the Hibernate framework and MySQL DB, based on the below configuration hibernate create a Table in MySQL DB.
User.hbm.xml
hibernate.cfg.xml :
It is an .xml file, in which DB connection details like username, password, url and Driver Class name etc... & hibernate properties like Dialect, show_sql and hbm2ddl.auto etc....
hibernate.cfg.xml You know very well every Java web application must have deployment descriptor configuration for application (either .xml or annotation configuration), below is the web.xml file for our application.
web.xml
In above web.xml file configured welcome file as a login.jsp page and Servlet class with urls login, registration. here Servlet class are controllers for this application. see the below two controllers.
LoginController.java
RegistrationController.java
Below are the Service declaration and Implementation Classes
BaseService.java
BaseServiceImpl.java
Below are the Dao Declaration and Implementation Classes
BaseDao.java
BaseDaoImpl.java
Hibernate Utility Class for Application. Using this class creating Hibernate connection and using this connection in Application Dao Implementation class
HibernateUtil.java
login.jsp
userRegistration.jsp
home.jsp
Login Example using Servlet, JSP, MySQL and Hibernate Framework.
Reviewed by Gurugubelli Technologies
on
January 30, 2017
Rating:
Bonjour, tout d'abord je vous remercie pour le code bien détaillée. J'ai testé le code mais lors de run de userRegistration un message d'erreur la ressource n'est pas disponible.
ReplyDeleteMerci d'avance
Hi Jon,
ReplyDeleteThanks for your comment, I have updated the web.xml file.
the options such as deny, grant, enable and disable login status in SQL Server. It also explains which options to use when. liteblue usps gov login
ReplyDeletetried the exact same code, on submitting getting 404
ReplyDeleteHi Akshay
ReplyDelete404 error means, your requisted resource URL is not available. Please share me what URL you have requisting and also provide a log trace.
hi your userRegistration.jsp content same like login.jsp
ReplyDeleteHey Macix, userRegistration.jsp and login.jsp files have different content. Check once.
Deletegandu
ReplyDeleteinitialy what is the user name and pass word
ReplyDeleteFor accessing application first need a user registration and use the same credentials you have given at the time of registration.
DeleteHI Team,
ReplyDeleteam able to see the login and i don't know the credentials
I think don't have a default user for this application, First try to register a user your self and use the same credentials for accessing application :)
Deletethe userRegistration.jsp is same as login.jsp. please help.
ReplyDeleteHello Debdutta, both jsp files have different content, please check once
Deletealso login controller and registration controller are same.
ReplyDeleteHey Debdutta, Login and Registration controllers have similarity but having different business logic. I think you have missed this logic :)
Deletehi, I'm receiving the following error message
ReplyDeleteException occred while reading user data: Cannot open connection
Gowthaman19 June 2019 at 03:18
ReplyDeletehi, I'm receiving the following error message
Exception occred while reading user data: Cannot open connection
The article is so appealing. You should read this article before choosing the Hadoop consulting services you want to learn.
ReplyDeletei got error "id to load is required for loading".what i do?
ReplyDeleteSame error I get.
DeleteSo what should I do?
where is struts.xml?
ReplyDeletekindly send me this file.
software testing company in India
ReplyDeletesoftware testing company in Hyderabad
Thanks for providing such a great blog with us about Login Example using Servlet, JSP, MySQL and Hibernate Framework.
please keep sharing.
very nice and provide me informative content thanks for sharing for more information.
ReplyDeleteBest Data Migration tools
Penetration testing companies USA
What is Data Lake
Artificial Intelligence in Banking
What is Data analytics
Big data Companies USA
What is Data Migration
What is Data Science
Software testing Companies
ReplyDeleteشركة مكافحة حشرات بالقطيف
شركة مكافحة حشرات بالدمام
شركة مكافحة الحمام بالاحساء
شركة مكافحة حشرات بالنعيرية
شركة مكافحة حشرات بالجبيل
شركة مكافحة حشرات بالظهران
شركة مكافحة حشرات ببقيق
شركة مكافحة حشرات براس تنورة
شركة مكافحة حشرات بسيهات
شركة تعقيم و تطهير بحي العمامرة
ReplyDeleteشركة تعقيم بحي الياسمين
تعقيم و تطهير بحي الفجيرة
Gerçek bodrum bayan arkadaş ile görüşme gerçekleştirmek için Bodrum bayan arkadaş sayfasına giriş yapabilir, Bodrum bayan arkadaş ilaları inceleyebilirsin: bodrumbebekleri.com
ReplyDeleteBodrum bayan arkadaş ilanlarına göz gezdirmek için hemen bodrum bayan arkadaş sayfasına tıkla birbirinden gerçek bodrum bayan arkadaş profillerini görüntüle: bodrumbebekleri
Bodrum bayan arkadaş sitesi olan Bodrumbebekleri ile sende hemen bir bodrum bayan arkadaş telefon numarasına ulaşabilirsin. Bodrum bayan arkadaş sayfasına giriş yapmak için tıkla: bodrum
You can order percocet online overnight shipping.These solutions are astonishing manufactured substances that change the working of the central tactile framework. When mishandled, they can provoke veritable repercussions, including enormous organ hurt, the improvement of a substance use issue, and even death in occasions of overabundance.
ReplyDeleteOrder oxycontin 80mg online
Order dilaudid 8mg online
Order Percocet 7-5mg online
Buy oxycontin 40mg online
Buy oxycontin 80mg online
Buy Percocet 10-325mg online
I would like to say more thanks about what you have created here on your blog. It is really very informative and interesting. Do you have any idea about the requirements for Turkey visa. A little bit of change in the requirement of a Turkish visa . Check all the updates in one click and increase the chances of your visa approval.
ReplyDeleteEN SON ÇIKAN PERDE MODELLERİ
ReplyDeletesms onay
Vodafone Mobil Ödeme Bozdurma
nft nasıl alınır
ANKARA EVDEN EVE NAKLİYAT
TRAFİK SİGORTASI
Dedektör
web sitesi kurma
ASK ROMANLARİ
Smm panel
ReplyDeletesmm panel
İSİLANLARİBLOG.COM
İnstagram Takipçi Satın Al
Https://www.hirdavatciburada.com
beyazesyateknikservisi.com.tr
SERVİS
tiktok jeton hilesi
ReplyDeleteخدمات نقل الاثاث
The best furniture moving company in Riyadh and Al-Kharj from the Clean Corner is one of the large companies that are widely displayed, where you can get a group of high-level services significantly with prices outside the competition.شركة نقل اثاث بالرياض
شركة نقل اثاث بالخرج
yurtdışı kargo
ReplyDeleteen son çıkan perde modelleri
en son çıkan perde modelleri
özel ambulans
lisans satın al
nft nasıl alınır
uc satın al
minecraft premium
I think this is one of the most significant information for me. And i’m glad reading your article. But should remark on some general things
ReplyDelete출장샵
출장샵
출장샵
출장샵
출장샵
출장샵
출장샵
Cheap Accident Lawyer has solved many case. Many accident victims face significant financial challenges in the aftermath of a car accident.
ReplyDeleteAccident Lawyer in Cheap Price
When you use collateral to secure a loan, the lender has the right to seize and sell your assets to recoup their money if you fail to pay back the debt.
ReplyDeletePersonal loan with best Company
Some of these supplemental coverages are included in the core policy, while others are sold as separate policies. Some insurers also offer usage-based insurance, which calculates your vehicle insurance costs based on your driving habits.
ReplyDeleteMotorcycle Insurance
Business Insurance
As a result, more organizations are making regulatory compliance a top priority in their strategic plans. In fact, according to MetricStream’s State of Regulatory Compliance Report 2021, 64% of respondents intend to increase their focus on regulatory compliance in the next 12 months.
ReplyDeleteBest Company for Medical Loan
Effectively managing outside legal services can lead to improved efficiency, effectiveness, and consistency of legal services. In today’s complex environment, lawyers need technology that enables them to handle large amounts of data and collaborate in real time.
ReplyDeleteFamily law Trust Lawyer without advance fee
With a holistic approach that includes technology, process optimization, and collaboration, lending institutions can enhance their Wedding loan approval workflow and improve their overall customer experience. By leveraging advanced Wedding loan Origination Systems (LOS), lenders can automate data collection, speed up processing times, and streamline operations without increasing staff workloads.
ReplyDeleteWedding loan Online
Property Insurance Provides benefits to employees who suffer work-related injuries or illnesses. It helps cover medical expenses and lost wages, protecting both the employee and the employer from liability.
ReplyDeleteOnline Property Insurance
This is an area that can cause a lot of confusion and stress for many people, and a knowledgeable attorney can help. An Legal Brutality attorneyexperienced can also provide guidance regarding the best way to divide inherited assets between children.
ReplyDeleteFull coverage Business Owners insurance, also known as major medical or comprehensive coverage, provides broad coverage of healthcare services. Business Owners Policy Insurance New Jersey Some examples of covered services include doctor visits, hospitalizations and prescription.
ReplyDelete