• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts Post

 
krish chaitu
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64618
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please be sure to ask Struts questions in the Struts forum. I have moved this post there for you.
 
Michael Ku
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic