File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

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.

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63852

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

[Asking smart questions] [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 /

This will allow you to use the same Action but multiple methods within the action.
I agree. Here's the link:
subject: Struts Post
It's not a secret anymore!