I am developing an application using Struts 1.3.10.
I want to know how to achieve the below thing in struts.
On clicking the link, I am loading the jsp page with some lookup values (prepare)
After page loaded, user will submit the details and will submit for DB (process).
I have used the below two approach:
1. Written one BaseAction which extends the Action and written two abstract ActionForward methods, one for prepare and another one for process.
2. In BaseAction of execute method, it will choose either prepare or process method using the request parameter.
3. All other application related Action will extend this BaseAction with (?method=prepare or process).
4. I don't want to use any hidden variables in my application. If I am using the above approcah I need to use the hidden variable for passing method as "process" while user submits the form.
I have also tried with Dispatch action, which are more or less follows the above approach with the parameter will be the part of the form.
Whether separate action for prepare and process will solve the problem?
Please advice the best approach to use.
When I used S1 I almost always used a base class that differentiated between GET and POST requests, and all form submissions were POST. I had prepareGet() and preparePost() methods (although I almost never used both), called validation manually, and if it failed (usually) called prepareGet() to reload any lists etc. needed on the JSP.