Help coderanch get a
new server
by contributing to the fundraiser
  • 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Different INPUT.jsp in DispatchAction

 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
How can I have different INPUT parameter value for my Dispatch action. As DispatchAction can contain multiple methods, I want to connect various methods to different input JSP (especially for errors). Please advice.

Cheers
Vicky
 
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In DispatchAction, the methods called will be depends on the Form parameter *method*.

For example, if you have a form parameter *method* with value *xxx*, you will then need to have a method:


And this method will be called whenever the method value equals to "xxx".

In the JSP, you can use JavaScript to check, when the form is submitted, what are your input values, and set the method value by:



And the corresponding methods xxx, yyy and zzz will be called accordingly.

Nick

[ May 19, 2004: Message edited by: Nicholas Cheung ]
[ May 19, 2004: Message edited by: Nicholas Cheung ]
 
vicky kumar
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Nicholos,
May be you got me wrongly. I need to direct the user to differenr error pages depending on the method executed in DispatchAction. I believe "input" parameter in action element works as error JSP also. But I want the JSP, that belongs to the method executed" to work as Input JSP also. Is it conceptually good to have different Input jsps for a given Dispatch action.

Vicky
 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


I need to direct the user to differenr error pages depending on the method executed in DispatchAction.


You can define various *forward* actions inside the struts.xml and use the method findForward() to forward the request to various *error handling* actions.



And the struts.xml looks like:



Is it conceptually good to have different Input jsps for a given Dispatch action.


It depends, but I am not sure whether it really needs to have such configuration.

Nick
 
Ranch Hand
Posts: 415
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
See why r u so bothered .....in ur different methods give differernt forward strings and give jsps what u need in ur action tag with multiple forwards

is there any issue in doing this ??
 
vicky kumar
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No Sreeni. That's a simple and best solution I think.

Thanks Srini and Nicolas..

Cheers
Upen
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic