aspose file tools*
The moose likes Struts and the fly likes Struts Post Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts Post" Watch "Struts Post" New topic
Author

Struts Post

krish chaitu
Ranch Hand

Joined: Oct 09, 2007
Posts: 32
Hi ,

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 .

so how can i make it the way i had to do.

any help is required.

Thanks
krish
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61010
    
  65

Please be sure to ask Struts questions in the Struts forum. I have moved this post there for you.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Michael Ku
Ranch Hand

Joined: Apr 20, 2002
Posts: 510
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
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts Post