27Dec/0831
CRUD Application : Struts 1, Hibernate and MySQL
Here is my Sample Struts, Hibernate CRUD application. This can act as starting point for those who are starting to build applications on hibernate and struts. I know struts 1 is sort of out dated, but i still think there are lot of legacy applications running on Struts 1.
This application has the following features.
- Basic Create, Update and Delete Operations
- Security (Login Support)
- Validation (Struts Validations)
- Internationalization and Localization (Look at the Links on the top of page, you can change the language of the application).
- Ant build script to build and deploy the application.
Download the source code leadapp.zip (5.66 Mb)
Building and deploying the application
- Create a schema/user using the schema.sql file in src/database
- Open build.properties and modify "tomcat.home" property to point your tomcat home directory
- Database username/password can be configured in the hibernate config file \WebRoot\WEB-INF\hibernate.cfg.xml
- Issue "ant clean deploy" command to build and deploy the application to tomcat.
- Access the application http://localhost:8080/leadapp (assuming tomcat is running on 8080 port)
- username/password is user@javachap.com/javachap
I hosted this application on stax.net, access it from here http://hw4999.dvkvarma.staxapps.net, please write in the comments section if you have any problems running the application.
Application Screenshots
Advertisement
Shared from Google Reader
- Griffin Releases iPhone-Controlled Toy Helicopter
- Hackers Are Climbing In Your Windows, So Hide Your Kids, Hide Your Files
- Woz reflects on how a musician taught Jobs the art of making technology human
- Obedient wives club!
- Welcome To The Future: Polymer Vision Demos SVGA Rollable Screen
- Plugin by C. Murray Consulting
Recent Posts
- 6th Grader and iPhone Application Developer
- The 5 Biggest Ways to Boost MySQL Scalability
- Enumeration Mapping in Hibernate
- Java 7′s Fork/Join Framework
- Understanding Java Weak References
Recent Comments
- vicky on How to make VOIP calls on iPhone using MagicJack Connection and Siphon
- ravish on Vodafone India – GPRS for iPhone without Data Plan
- ravish on Vodafone India – GPRS for iPhone without Data Plan
- ravish on Vodafone India – GPRS for iPhone without Data Plan
- Sandeep on Vodafone India – GPRS for iPhone without Data Plan
Blogroll
Tags
centos
cloud
crud
cydia
database
datasource
debugging
dwr
eclipse
erd
ermaster
gprs
greatandhra
hibernate
humor
install
iPhone
iSip
ldap
Linux
magicJack
mediawiki
modelling
movie
mysql
online
openldap
permalinks
plugin
reference
rss
schema
seo
siphon
source
spring
storage
struts
theme
Top Menu
twitter
voip
wordpress
yahoo
yui



December 31st, 2008 - 10:58
Why are people still using struts 1 ? We are in the 21st century, there are far more better alternatives.
Thank you for the tutorial, it is really well done.
January 3rd, 2009 - 18:45
Hi,
I’m very interested in this tutorial… I did all the steps mentioned here, unfortunately when calling localhost:8080/leadapp I get the following error:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Exception in JSP: /index.jsp:1
1:
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
root cause
org.apache.jasper.JasperException: Exception in JSP: /login.jsp:8
5:
6:
7:
8:
9:
10:
11:
Can you tell me what I’m doing wrong? Do you need the whole stacktrace?
Any help would be really appreciated – keep the tutorial going
Stefan
January 21st, 2009 - 20:17
I tried the example online at http://hw4999.dvkvarma.staxapps.net but theres some problem with the login step… someone can help me with that thing please.
Thanks a lot.
January 22nd, 2009 - 15:42
hi guys. I tried to tests the example online at http://hw4999.dvkvarma.staxapps.net but there’s some errors (we need all the files about struts tags: html, beans, etc).
I already created the lead database and I compiled the sorce code at my pc fixing some errors that I find, but… there’s sme error with the login. PLease someone could help me, Please.
Thanks a lot.
Dieg.
January 22nd, 2009 - 21:22
I also try the example and you can fix the tomcat problem adding the file: “struts-bean.tld”
Rergards
January 23rd, 2009 - 08:16
Hi,
thank you for this code. But i think it would be best if you have a step by step tutorial
Im really keen on learning struts
January 23rd, 2009 - 16:05
I detected the same error you mentioned, at this time if you try to do the loging in the example even if you use the user and password correct (user@javachap.com and javachap) appears the frase: Invalid User name/password.
Please please, if the author could fix that thing I’ll be super hiper happy. Please. Thanks a lot
l
January 24th, 2009 - 16:08
Please someone can help me with the problem in the login? Thanks a lot!
Marios Res
January 27th, 2009 - 15:30
When I try to log the application the message “Invalid Email/Password. Please try again.” appears again. I’m using Eclipse and Tomcat to test the source code, and Tomcat console shows an error with hibernate session, I don’t know what’s wrong, Please someone could help me with that.
Thanks
Leandro
Brazil- South America
February 2nd, 2009 - 16:39
Dear friends I downloaded the source but I found a problem about the loggin…someone could help me please.
Thanks a lot
Crist
February 2nd, 2009 - 16:49
Dear friends I’m trying the online example and I found the follow tomcat error:
org.apache.jasper.JasperException: An exception occurred processing JSP page /login.jsp at line 8
5:
6:
7:
8:
9:
10:
11:
You could fix it if you include the struts-bean.tld file in your WEB-INF file in your tomcat istallation.
Thanks and PLEASE if someone can help me with the problem about the loggin I’ll be happy.
Crist
February 11th, 2009 - 20:07
Great application
Is it OK to modify little bit for personal use only?
Thank you!
February 28th, 2009 - 21:47
Dear Imsev Benichou.
You mentioned you have already the application working. Please could you help us about the loggin problem?
Thanks a lot.
Dave
March 8th, 2009 - 18:37
@Imzey Benichou
Yes you could !! No Problem
March 8th, 2009 - 18:39
@Dave Sumners
Dave can you send me the stack trace, I can help you to fix the problem
March 9th, 2009 - 02:16
@Leandro Escobar
Sorry i changed the password for security reasons.. Now created the user again.. u can login now… using user@javachap.com/javachap
March 22nd, 2009 - 01:07
thanks for the project sources. with some minor changes i could make it work on netbeans 6.5 with glassfish v3 prelude. i could send you a war file, that will likely help a lot of users in getting upto speed.
also, just as an fyi, although the application works fine, i noted from glassfish logs that there were ‘severe’ errors and some related ‘warnings’ later. It looks like there are some kind of systemantic bugs in javassist.jar that might explain severe errors of ‘Javassist Enhancement failed’ due to ‘java.lang.NoClassDefFoundError:’ found at javassist.util.proxy.ProxyFactory.createClass3(ProxyFactory.java:342). these errors do not seriously impair the application at this point, so i am not debugging further.
thanks.
July 20th, 2009 - 09:22
I try to run this application in my system earlier it was showing some errorin login.jsp and resourcebundle file but now its working fine. its a awesome application.
Thanks & Regards
Mitul
July 20th, 2009 - 09:24
The error you are seeing in login.jsp that is tomcat server problem. check your application is running only tomcat server not other server.
Also please check path in a resource bundle in struts-config.xml file.
August 30th, 2009 - 23:05
Great blog you got here…keep up the good work.
November 10th, 2009 - 22:36
Vijay,
Thanks a lot, a great tutorial.
This application is working in my computer. I’m very happy.
Best Regards
December 24th, 2009 - 03:02
Hi, I am planning to host mysql and hibernate applicaiton in stax. I cudnt able to connect thru the mysql thru jdbc.url. Please look into this blog for exact problem and my configuration files.
http://developer.stax.net/profiles/blogs/web-application-with-struts2?xg_source=activity
Can you let me know how you connected to mysql? can u send me across hibernate-cf.xml configuration.
Thanks
siva
December 24th, 2009 - 05:09
@Chantal
Thanks Chantal !
August 27th, 2010 - 12:10
i downloaded the files in my system deployed it in tomcat 6 and created the database lead in MySql.But if i add a user in the user database and log in with the added email and password it does not login. It works only for username:user@javachap.com and password:javachap are you retriving values from datbase and validating for login or ypu are using some static values. Please help me Mr.Java Chap
February 24th, 2011 - 09:00
@arun
Perhaps you are right but once you recompiled it.. you will be able to get it with your new login…
It appears that hibernate caches the user data and hence ignores the dynamic entry directly via db.
Gautam
August 21st, 2011 - 14:25
Hi all,
i am not able to download source code from here. please any one can send me the whole running source code. (arbindnegi@gmail.com)
@ JavaChap : please send me the code on my mail id. (arbindnegi@gmail.com)
August 22nd, 2011 - 10:14
i am getting the following error messages while try to login to leadapp with (userid-user@javachap.com,password-javachap).
Invalid Email/Password. Please try again.
could you please help me out to resolve.
Thanks in advance….
October 6th, 2011 - 23:53
hi there, thanks for your tutorial..
October 24th, 2011 - 05:20
hello, thanks for the good tutorial..
there’s an error if I click delete button on the lead listing page, it happens when there’s no data in lead lists.
October 27th, 2011 - 13:08
good
December 31st, 2011 - 22:01
wonderful, worked like a charm on the first try. I’m using jdk1.6.0_22, tomcat 7.0.4, mysql 5.1.53, many thanks