I have a requirement where when user clicks on link user has to go to action class & from there he will be forwarded to jsp page & once the user submits in the jsp page user has to got to same action class that is used for link .
What do you have so far? I assume that you have set up Struts in your web app. Have you created and mapped the Action classes, forms, etc?
Chris Boldon
Ranch Hand
Joined: Aug 10, 2006
Posts: 190
posted
0
Your description isn't very clear but I'll see if I can help.
You want to display a page with a link on it. This link goes to an action which then forwards to a JSP page. When the JSP page submits you want it to run a method on the same Action which just forwarded to the JSP page?
If this is the case you're going to want to use a dispatch action.
1.) In your Action extend DispatchAction instead of Action. 2.) You will not use an execute method, instead you will have different methods which will be accessed through a parameter passed to the action. 3.) Edit your struts config to define a parameter name. ie if your parameter=method in your struts-config.xml and your method name in the action is createUser (/createUser path in config) you would access the method by calling /createUser.do?method=createUser.
This will allow you to use the same Action but multiple methods within the action.