I'm using Struts 1.2.4 (along with the validator framework), and I've noticed that for my forms that do a Post, the action class is executed twice. I put log statements in my code to try to figure out what is happening. The sequence of events is as follows:
- User presses Update button on a JSP - doPost method invoked (ActionServlet) - Struts validation methods invoked - execute method (Action class) entered - execute method (Action class) returns forward action of Success - processing returns to the same JSP ......................................................................... - doGet method invoked (ActionServlet) - Struts validation methods invoked - execute method (Action class) entered - processing returns to the same JSP - web page is displayed on browser
Has anyone seen this problem or know what is happening here? Thanks very much for your assistance.
Check out if ur validator function is submitting ur form and u r using the html:submit.......this happens when u have the button of the type submit and u submit in javscript function also which sends 2 requests.
let me know if this works
Joined: Dec 04, 2002
Thanks for the reply. I didn't see your reply until today (April 4). Last night, I made a few functional changes (unrelated, I thought), and one of them seems to have solved the problem.
There were a couple work fields stored in the form bean (ActionForm), called userAction and systemAction, that were being used to determine which buttons to display based on what the user was trying to do. I removed the field called systemAction..... And when I ran the next test, the system did a doPost but did not follow that with a doGet. How this could have solved the problem, I can't even begin to imagine....
When I get home from work tonight, I'll check the code rendered by the validator framework, as you suggested. I am using html:submit for my buttons; perhaps changing them to html:buttons would also have solved the problem (and a better solution as well).