At 09:58 PM 5/29/2004, Rick Reumann wrote:
[EMAIL PROTECTED] wrote:
I was wondering if anybody had already thought about an additional parameter linked to a struts-forward allowing page pre-processing. This parameter could point to a new kind of model action that will complete the model with information needed by the view any time the forward is activated.
Or... I'm missing something ...
How do you handle such a case?
This question comes up a lot, and I've never been content with any of the solutions provided and I've been following this list for a while. My first choice is to use the Session for these lists... I know there will be garbage in there but to me it's the cleanest solution (and hey RAM is cheap:). Another solution proposed is when validation fails set up a scenario where you forward to the 'prepare' action again. I haven't used this later approach so there might be some issues with it like making sure the rest of the form data is populated etc. Another solution that everybody hates because it puts business logic in your Form beans is to have the validate method in there make a call to repopulate what your page needs. I've seen the reset used for this also... and although it breaks the MVC structure, it's actually sort of neat since the reset acts as your "prepare" making sure the page that is form is going to be used on has everything it needs. I still don't recommend you use the FormBean for this though - makes it difficult later on to debug and figure out what's going on since most expect the form beans to be "dumb"
since they are really only part of the view layer.
If the Session isn't an option for you, I wouldn't even mess with using the default validation stuff, and call validation directly from your Action (either in execute or the appropriate dispatch method), this way you'll have feedback on failure and can repopulate what you need accordingly. (I've never run into performance problems using the Session though).
-- Rick
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]