This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Struts in jsp for db add and update Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts in jsp for db add and update" Watch "Struts in jsp for db add and update" New topic
Author

Struts in jsp for db add and update

Ravi Seshu
Ranch Hand

Joined: Mar 19, 2005
Posts: 38
Hi ,
i m new to struts, how should i use struts for my db access list one of its field in a combo box , and update if requiered.

also add a new row to the db table...

howz it possible any clear suggestion...

plz
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
If you're looking for a quick and easy way of accessing the database from the view layer as is possible in PHP, ASP, and even in JSP through jstl, you won't find it in Struts. The Struts architecture is specifically designned for separation of layers between the view (The JSP), the controller (The Action Form) and the model (Classes you write to acces the database, and objects you write to represent the business model).

The struts way to do it is:
  • User calls an action
  • Action calls on classes in the model that access the database and return information
  • Action uses this information to populate an ActionForm
  • The Jsp reads the information in the ActionForm to display the data


  • My advice is to look at the JSPs, Action Classes, and ActionForms in the struts-example.war that comes with the download, and get a feel for how they work together.


    Merrill
    Consultant, Sima Solutions
     
    It is sorta covered in the JavaRanch Style Guide.
     
    subject: Struts in jsp for db add and update
     
    Similar Threads
    New to Websphere - J2EE Project.
    open source contributors wanted
    passing values of Select box from JSP to Action class thru form Bean
    Portlet getting log off
    configuring datasource in struts-config.xml