Hi!
I'm using Struts 2 with tiles, and zero configuration setup. I'm performing validation on my actions (with annotations), but I have a problem. I need a series a values of my jsp's, basically lists. So I need to load them before getting to the jsp.
What I do is I have a fetch action that gets called and then this redirects to the jsp that renders the form. So I have my lists in the form. But when I submit the form, if there's a validation error, and I get back to the form, the lists aren't there so my form doesn't work.
I know I cloud use the preparable interface, but I want to avoid that, as I have multiple methods on my action, and the prepare method would have to perform quite a few list fetches on the db, and I want to do that as few times as possible. Ideally I would only have to perform those fetches if the result is "input".
So the solution I've come up with is implementing an interceptor that checks the result, and if it is "input", then execute the method that fetches everything from the db. But that doesn't work. The interceptor works fine, and it does what it's supposed to, and even if I check the valueStack with:
the lists are there, but they don't appear on my jsp.
So, the fetching action is:
This gets me to the jsp with the form. Then the form submits to the action with the validation:
And the action is:
And when this is the result, I get back to the form, but my lists don't get loaded.
Any suggestions? Thanks!