• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts Post

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please be sure to ask Struts questions in the Struts forum. I have moved this post there for you.
 
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic