You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Kataria, Satish" <Sa...@fmr.com> on 2004/07/28 13:26:09 UTC

RE: advice needed: view+form needs data from an action

I am not very clear what is the issue ur facing.
For populating the dropdowns , u cld hit DB in the action and polulate
apropriate DTO and put it in request.
U cld then use the values from the DTO for populating the dropdowns.
Next on form submission u cld persist the new values to DB in the submit
action.
Can u elaborate on the issue u r facing

Thanks, 
Satish

-----Original Message-----
From: alu, artifex [mailto:apache-user@artifex.co.at] 
Sent: Wednesday, July 28, 2004 5:02 PM
To: Struts Users Mailing List
Subject: advice needed: view+form needs data from an action


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


Re: advice needed: view+form needs data from an action

Posted by "alu, artifex" <ap...@artifex.co.at>.
Kataria, Satish wrote:

>I am not very clear what is the issue ur facing.
>For populating the dropdowns , u cld hit DB in the action and polulate
>apropriate DTO and put it in request.
>U cld then use the values from the DTO for populating the dropdowns.
>Next on form submission u cld persist the new values to DB in the submit
>action.
>Can u elaborate on the issue u r facing
>
'f course:

i'm a f****** moron! i supposed that the input of an action must not be 
an action but a view (jsp or
something). i have no clue what made me think so but i suppose it seemed 
too easy for me =)

i'll consider my sins...

thank you a lot for taking the time to write a response =)

cya
art

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