You can view the tutorials best in Google Chrome, Mozilla Firefox, Opera, higher version of Internet Explorer

Struts2 Insert,Update,Delete,Operations Through JDBC [ Real Time Application ]

Struts » On Feb 1, 2012 By Sivateja

Let us see  on how to work with Insert,Update,Delete operations through struts 2 with JDBC connect, a real time application.  Even we will see the same application using Struts 2 and Hibernate.

Actually i have not covered example on ServletRequestAware, ServletResponseAware Interface(s) earlier,  but its time to use these interfaces too :-).  Yeah i have used these interfaces in this program.

 

Directory Structure

Files Required

  • Delete.java
  • Display.java
  • Links.java
  • Mybean.java
  • Save.java
  • Update.java
  • Updates.java
  • web.xml
  • struts.xml
  • dsuccess.jsp
  • edit.jsp
  • error.jsp
  • index.jsp
  • retrive.jsp
  • ssuccess.jsp
  • usuccess.jsp

Delete.java

Display.java

Links.java

Mybean.java

Save.java

Update.java

Updates.java

web.xml

struts.xml

index.jsp

insertr.jsp

error.jsp

edit.jsp

dsuccess.jsp

retrive.jsp

ssuccess.jsp

usuccess.jsp

 Output






By [ Java/J2EE Developer & Web Designer ]
Founder of Java4s.com - Indian, lives in United States. You can contact me at sivateja [at] java4s.com
Follow me on


Comments

15 Responses to “Struts2 Insert,Update,Delete,Operations Through JDBC [ Real Time Application ]”
  1. Anirban Chakraborty says:

    In the example STRUTS-JDBC-CRUD in every action you write the JDBC code.
    Please write the JDBC code separately & call the methods in ACTION & also upload the code as soon as possible.

  2. suhel Mulla says:

    hi,
    I don’t get the “struts-tags” file from your code…..
    please help me.

  3. Java4s says:

    @suhel Mulla

    You no need to add separately :-)

  4. parivallal says:

    I don’t get the “struts-tags” file from your code…..
    please help me.

  5. Java4s says:

    @Parivallal

    We no more need to add any external struts-tags in 2.x :-)

  6. Pushker says:

    you should use custom tag in JSP page and use a separate class for the connection

  7. preeti says:

    Can you Please give this code in war file.

  8. Sameer says:

    Really Nice Example. Thanks you so much.If you have some other examples plaese share.

  9. Manoj says:

    Hi sir i am new in struts2, i want to display all records in tabular format including Edit button ; When user click on that edit button the open new form in that all details will be displayed and that user will be edit that particuler record only please give me that code..
    Thanks in advance…

  10. Sanjeev K says:

    Hi,
    I have trying to develop“Struts2 Insert,Update,Delete,Operations Through JDBC, Everything i configure correctly but i didn’t get a pre-defined classes or methods while developing progm Pls help me.

  11. JavaTrainee says:

    Hey great article.
    Can you please post an article on the best practices for struts2+jdbc application cdrud operations?
    I read somewhere that it’s not a good practice to use ServletRequestAware for db connections. Please help

  12. rakesh says:

    you have to add jar files first, then “/struts-tags” will work…

  13. harsh says:

    can you provide me code for CRUD operation in struts2 using session as persistent technique and not database

  14. Anil says:

    Where did you fix the context path Struts-insert-edit-delete.

Name*
Mail*
Website



By posting your answer, you agree to our comments policy.
Most Recent Tutorials
Hibernate Recent Posts
Spring Recent Posts
Struts Recent Posts
Recomandded Links
Current & UpComing Tutorials
Sitemap :
spring Hibernate struts Json Ajax Log4j Log4j coreJava Servlets Web Services


Upcoming
  Web Services [ SOAP ], JSP
Facebook_Java4s  Twitter_Java4s  GooglePlus_Java4s  Youtube_Java4s 
© 2010 - 2014 Java4s - Get It Yourself.
The content is copyrighted to Sivateja Kandula and may not be reproduced on other websites.