• 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

html:button Struts jsp code

 
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I have been looking online for jsp code examples using the struts tag <html:button> but can find very few mentions of it. Is this because it is not used much? Is there a better tag to use if I have a page with 4 buttons, each which will redirect the user to one of 4 differant pages?
Thanks for any ideas,
Kim
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Kim,
A google search turns up quite a few examples. The first one is excellent.
 
Kim Kantola
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for your reply. I am actually interested in buttons which when clicked will redirect the user to another jsp, not radio buttons. I have googled html:button but didn't find much about non-radio buttons. Any other tips very appreciated.
 
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Kim Kantola:
Thank you for your reply. I am actually interested in buttons which
when clicked will redirect the user to another jsp, not radio buttons. I
have googled html:button but didn't find much about non-radio buttons. Any
other tips very appreciated.


If you are not really allergic to a mix of JavaScript and struts-tag, then
it's possible like this.

This will allow you to fire form submission based on some dynamic
condition. If you need a simple link kind of effect (no form submission),
then, document.location="<html:rewrite ... />" can do the trick.
And then the place, wherever you require a button,

I use this to provide more than one Actions for a single form. Please note that Click, here, is intentionally misspelt to pass through the forum posting. It does not allow html codes.

HTH.

Thanks and regards,
Kinjal Sonpal
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A method without javascript:

If the buttons all have different text, you can give them all the same name and have your action match up the text of button with your forward.

If any of the buttons contain the same text (ie all say "Edit"), then you must give each one its own name with getters and setters for each. There are a multitude of tricky things you can do behind the scenes in your form and action to determine which button was clicked and which forward to use. Google should help find some.
 
Kinjal Sonpal
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Marc Peabody:
A method without javascript:
If the buttons all have different text, you can give them all the same name and have your action match up the text of button with your forward.

If any of the buttons contain the same text (ie all say "Edit"), then you must give each one its own name with getters and setters for each. There are a multitude of tricky things you can do behind the scenes in your form and action to determine which button was clicked and which forward to use. Google should help find some.


Hmmm... Very interesting way. I never realised this. One more thing Mark. I'm using DispatchAction for this. As you can guess, I'm using JavaScript code to determine, which method of DispatchAction should be called and accordingly I attach the value for the query parameter. I'm not getting a clearer idea as to how the above metioned way can be implemented. Please throw some more light on this.

Thanks and regards,
Kinjal Sonpal
[ June 03, 2004: Message edited by: Kinjal Sonpal ]
reply
    Bookmark Topic Watch Topic
  • New Topic