I have spent hours trying to use the Prepare interceptor to populate a list to be used in my combobox for my form. At first it would not execute unless I submitted the form once.
I then realized I needed to access my form through the Action and not directly through the .jsp address!
Now, as I call the action, the prepare() method is executed, populating my list, but the execute() method is executed automatically after, thus returning "success" and sending my form to the success page, without having rendered the contents of the form in my browser, nor taken into account the validation process.
Here is my struts.xml file:
My Action file:
My .jsp file:
What I simply want is to populate my list, then show my .jsp page in my browser, have it filled in and passed through validation (using the prepare method again if validation fails, like I read I needed to do), and then when the validation is ok, go to my succes.jsp page.
I hope I gave enough information (this is my first time here). I have a feeling my problem is either caused by a lack of attention or a fundamental aspect of Struts that I missed (I have started using this framework very recently.
Thanks in advance.
Joined: Mar 26, 2010
I'm sorry if my question is stupid but I really need some help on this. I've been playing around with the prepare() function and validation so long that I'm just lost and disoriented.
You don't need Prepare interceptor in this case.
Just add one more action and in that action class write a code to get the values for combobox and set it to list.Return a string from that method in action class,so that it in turn renders input.jsp where we need to enter our input.