Hi Antonio, i do not understand. The action is executed if the form is submitted, this is after the jsp has been displayed. I want to fill the form with values from database before the jsp is displayed. I need the typical 'edit' function, not create. Regards, Andy
apetrelli wrote: > > Ilja S. ha scritto: >> Hi >> Action class is right place. >> Common way is to have some layer working with DB like DAO pattern. >> Then You can have some service layer between DAO and Action which you >> call from Action class. >> Call it, get data transfer object from DB, copy its properties to >> ActionForm instance and forward request to your jsp page with form. >> Struts will do the rest. That is all. > > The problem is that the ActionForm instance is created only when needed. > In case of a request-scoped form bean, it is created only on form > submitting. > So you have to populate the HTML form with the correct values taken, for > instance, from a domain object, or a data transfer object (DTO). > To make things clear: > 1. Call the action that will show the JSP page containing the form. > 2. The action calls the model layer, putting an object (filled with DB > data), for instance, in request scope. > 3. Forward to the JSP page. > 4. Use <html:xxxx> Struts' tags specifying "name" and "property" and > eventually "value". > > You can use DAO and DTO as Ilja suggested (though I don't like it, I > prefer domain objects, but that's another story). > > HTH > Antonio > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Init-of-forms-tf2337990.html#a6515994 Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]