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

Struts » on Feb 1, 2012 { 29 Comments } 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

  • web.xml
  • struts.xml
  • dsuccess.jsp
  • edit.jsp
  • error.jsp
  • index.jsp
  • retrive.jsp
  • ssuccess.jsp
  • usuccess.jsp












You Might Also Like

  ::. About the Author .::

- Full Stack Java/J2EE & UI Web Developer
Founder of Java4s - Get It Yourself, A popular Java/J2EE Programming Blog, Love Java and UI frameworks.
You can sign-up for the Email Newsletter for your daily dose of Java tutorials.


29 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:

    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:


    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:

    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. 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.

  15. Harendra says:

    to connect the jdbc jar file.

  16. Tanuj says:

    In above example my update action is not working . Number column is not working
    plz help…

  17. Soubhagya Padhi says:

    In the above example you used a map to populate data in update through sno..but what is that #application you used in edit.jsp,can you just explain me?

  18. hari says:

    STRUTS 2.X CRUD OPeration program is wrong. I t is showing error .kindly rectify

  19. pradeep solanki says:

    realy nice code

  20. my dear sir,
    i am very grateful to you. your codes work well. i learn much from them. thanks.

  21. sir,
    can you add the search option in this application of yours? i need this application with search. sir, plz help me.

  22. Swapnil Mahajan says:

    Great example for new learners, But I don’t get the “struts-tags” file, Please provide me

  23. Jitendra Modi says:

    Really nice working example.

    @for All, who don’t get the “struts-tags”, Add Struts2-core-XXX.jar – library into your class path by add as external Jar from “Java Build Path” in Eclipse.

  24. Ravi says:

    i need search page in struts2 search with name,mobile number pls

  25. sandeep says:

    me getting request always as null

    Mar 12, 2016 11:42:59 PM org.apache.struts2.dispatcher.DefaultDispatcherErrorHandler error
    SEVERE: Exception occurred during processing request: null
    at com.sandeep.struts.DisplayAction.execute(
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

    would you anyone please help me

  26. vadgama kapur says:

    very nice example ,completely work I code , thank you ..

  27. sathish says:

    where to create struts.xml
    –>what is inside css ans js(folders)
    —> weather i need to create table in sql scrabbook
    do reply me ….am getting 404 error

  28. pravat says:

    type Exception report


    description The server encountered an internal error that prevented it from fulfilling this request.



    note The full stack trace of the root cause is available in the Apache Tomcat/6.0.41 logs.


By posting your answer, you agree to our comments policy.
Most Recent Posts from Top Categories
Hibernate Spring Struts
Contact | About Us | Privacy Policy | Advertise With Us

© 2010 - 2018 Java4s - Get It Yourself.
The content is copyrighted to Sivateja Kandula and may not be reproduced on other websites.