struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Millson <mmill...@meritonlinesystems.com>
Subject Re: advice needed: view+form needs data from an action
Date Wed, 28 Jul 2004 12:21:15 GMT
What I do is populate the data in the form's validate() method if an
error is found. For example, if an option collection for a pulldown menu
is used on the input page, when validate fails, I create the option
collection and store it as a request attribute. That way it is in scope
when the request gets redirected back to the input page.

Mike

On Wed, 2004-07-28 at 07:32, alu, artifex wrote:
> i've ran into an problem using struts or, maybe, it's me not 
> understanding the mvc concept correctly:
> 
> the user has to fill out a form which contains several drop-down-boxes 
> filled with possible values from
> a database. so i need an preceding action to gather the data from the 
> database. if the form is submitted
> it's submitted to a different action which should persist the user's 
> inputs. however, if the user enters
> semantically incorrect data he should be redirected back to the input 
> page - loosing the data collected
> from the database in the previous action.
> 
> i suppose there is no way solving this issue using form validation via 
> the validate() method of the actionform.
> another possible way would be that the second action validates the form 
> (which would render the validate
> method of the action form useless in most cases) and, if  the validation 
> fails, gathers the database records
> again and forwards it to the input page. so i'd have to actions doing 
> virtually the same.
> 
> the third way i figured out is to not use pre-populated input pages at 
> all. i could use javascript popups to
> populate certain fields. but i don't want to use popups.
> 
> i'm pretty sure that this is not a uncommon issue and hopefully someone 
> figured out a clever way to deal
> with this problem.
> 
> thanks in advance
> art
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message