struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Hardy <>
Subject Re: DynaActionForm and the 'pull' model
Date Sat, 21 May 2005 16:13:11 GMT
On 19/05/05 21:29&nbsp;Laurie Harper wrote:
> This is what I decided to try first. I threw together a prototype last 
> night, and it seams to work well. Basically, the idea is:
> - extend the view API to include 'View.toMap(Map props)' and 'void 
> View.fromMap(Map props)' on each view class
> - you can then do view.fromMap(form.getMap()) and 
> view.toMap(form.getMap()) to translate between views and form beans
> - add a custom tag which takes a form bean and a view and loads the 
> form's map from the view (I've implemented this so it can lookup the 
> form bean from an enclosing <html:form/> tag, so you only have to pass 
> in the view)
> Now, my JSPs can do something like this:
> <jsp:useBean id="view" class="MyViewBean"/>
> ... setup view (e.g. populate from db) ...
> <x:loadForm view="${view}"/>
> Now, the form bean associated with the enclosing form is populated from 
> the view object. On subsequent page loads, I can skip the loadForm tag, 
> and the form bean has the data from the previous submission.

You skip the whole tag? Using JSTL or something in the JSP? How do you 
tell? Can you do that inside the loadForm tag to keep the JSP cleaner?

Surely though you need some items of data just for display (which wont 
be resubmitted with the form because you didn't put them in form fields) 
and you can also use the view object to check whether you need to save 
(if nothing changed)?

BTW how does your viewbean behave? Does it call the back end when it is 
instantiated, or just when it decides it needs the data?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message