I don't know if the manual approach will work in that case or not. It
will be interesting to find out though.

For my callback approach, I tried extending from RequestProcessor, which
should have the advantage of working with the built in struts validation
schemes. I was not successful at finding a good hook point to make the
callback though. I needed the hook between the validation itself, and
the forward to the input view, both of which are handled in the
processValidate method.

If someone else sees a way to hook into the RequestProcessor to handle
this, I'd love to hear how!

Joe

> -----Original Message-----
> From: Rick Reumann [mailto:[EMAIL PROTECTED]] 
> Sent: Monday, February 10, 2003 5:51 PM
> To: Struts Users Mailing List
> Subject: Re: Where to repopulate dynamic lists ?
> 
> 
> 
> 
> On Mon, 10 Feb 2003 10:16:26 -0500
> "Joseph Fifield" <[EMAIL PROTECTED]> wrote:
> 
> > This topic seems to keep coming up, and with no real good solutions 
> > (IMHO). One point that seems to be made frequently though, 
> is that the 
> > logic to repopulate the lists really doesn't belong in the 
> ActionForm, 
> > yet that seems to be the most convenient place to put it. I know I 
> > would really like this logic to go in the Action. My solution 
> > currently consists of setting validate to false in 
> struts-config.xml, 
> > and validating manually in my action:
> > 
> > ActionErrors errors = myForm.validate();
> > if (hasErrors(errors)) {
> >   populateLists();
> >   saveErrors(errors);
> >   return getInputForward(mapping);
> > }
> > 
> 
> I'm not sure how all of this would work using 
> DynaValidatorForm and DispatchAction which I'm using. It 
> seems so simple to just have the method 
> BusinessLayer.populateLists() in the reset method of a form 
> bean that your DynaValidatorForm extends. I'll have to look 
> into using your approach using the built in validation and 
> see if I could get it to work. 
>  
> 
> > Although I don't particularly like this approach either, 
> it's the one 
> > I like the best (so far).
> > 
> > One idea I had (and tried to implement) was to put a 
> callback in the 
> > Action that was invoked after validation failure, but before 
> > forwarding to the input view? What do others think of this 
> approach? 
> > What other solutions are there?
> > 
> > Joe
> > 
> > > -----Original Message-----
> > > From: Rick Reumann [mailto:[EMAIL PROTECTED]]
> > > Sent: Monday, February 10, 2003 3:58 AM
> > > To: Struts Users Mailing List
> > > Subject: Where to repopulate dynamic lists ?
> > > 
> > > 
> > > Sorry to repost this question but it still has me wondering...
> > > 
> > > 
> > > Say you have a form where a user is to select "An Order To
> > > Update" from an options list. Now also assume that these 
> > > orders to choose from change very frequently. You also will 
> > > need to validate the form when it's submitted.
> > > 
> > > * Where is it best to repopulate this type of dynamic list
> > > (example above: 'orders')? The list of orders that make up 
> > > the options list needs to be repopulated somewhere in case 
> > > validation returns false and returns the user to the form 
> > > page again.  
> > > 
> > > It seems like you have three choices:
> > > 
> > > 1) In the reset method repopulate the list by making a call
> > > to business layer to get back your list and put in scope (or 
> > > maybe even directly into FormBean).
> > > 
> > > 2) Use session scope so the list is available at all times
> > > until repopulated by some setUp type of action.
> > > 
> > > 3) Possibly set this list in application scope upon container
> > > start up and maybe have a thread running that periodically 
> > > updates the list and put the new list back into application scope.
> > > 
> > > Are there any other options available? I happen to like #1
> > > the best but I'm wondering what others think. I don't really 
> > > like option 2 as it requires a form to be put into session 
> > > scope that really doesn't need to be there (apart from the 
> > > re-population of lists). Also a pain to monitor cleaning the 
> > > form out of session when it is no longer needed. Option 3 
> > > would be ok if the information in the list rarely changed, 
> > > but if it's data that changes very frequently I wouldn't want 
> > > to rely on some time interval to have to go by before getting 
> > > fresh data.
> > > 
> > > Curious what other's thoughts are on this situation.
> > > 
> > > Thanks,
> > > 
> > > --
> > > Rick
> > > 
>  
> -- 
> Rick Reumann
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to