I am stuck and need your knowledge and experience. When the button is my JSP is clicked, there are two action forms involved, threadForm and postForm. The threadForm is populated by hidden fields and text fields that are passed from the JSP. All the properties of the threadForm are to be inserted into a table in the database by the threadInsert() method and this method returns a primitive int threadID. The properties in the postForm are also populated by hidden fields and text fields that are passed from the same JSP, except that the postForm has one additional properties - threadID, which is obtained from the insertion of the threadForm into the database. Thereafter, all the properties of the postForm are to be inserted into another table in the database by the postInsert() method. How do I handle this situation? Please help.
Joined: Feb 20, 2002
Please post a code snippet of the JSP with the two forms.
I understand what you are trying to accomplish, but not sure on what the problem is? I don't necessarily need code, but are you using DispathAction? If not, just a standard action servlet? Are you using DynaForms or form classes? Typically in the scenario you descibe, you have a single form and the ID is null or blank in your first process, then, when passed back to the same JSP, the ID now has a value and is posted during the second process you describe. Your action method would need to check the value of ID to see if you need to perform the first or second action, based on whether the ID is null or not. I personally would recommend using DispatchAction instead and based on which option is clicked, call the appropriate method, rather than have a single method doing both processes.