Populating an (Jakarta Struts) ActionForm from a data source
843836Aug 11 2004 — edited Sep 19 2005Hello there. I've tried googling and searched this forum quite a bit for an answer to this and I'm stumped, so any help would be very much appreciated.
The scenario is this: I have an ActionForm which I am using to collect and validate data entered via a form in a JSP and I'm then saving it to the database via some TOs (Transfer Objects*) and some DAOs (Data Access Objects*). This works great when I am adding new records as I always start an ActionForm with empty values in it's properties. Now I want to edit some of the records I have created in the database. The TOs are populated from the database successfully (using my DAOs) but I can't find a way of getting those values into the ActionForm so that the form in my JSP has the values from the database i it rather than empty fields.
I'm sure this must be one of the simplest things to do but alas I can't find any sample code or descriptions of how to do it. Again, any help would be great.
Thanks
* J2EE patterns