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]