This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

html form +struts submit values

 
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all I am working with a html form that has to have several submit values in order to determine the action that is to be taken. The problem that I am encountering is that when I get into my action class for that page I am using the property and value portions of the submit tag to determine the right action. This would be fine if I could still specify the text that is displayed on the screen, which unfortunately is being taken from the value portion of the submit. I can see this is a horrible thing to have, as any change to the presentation would also mean a required change in the code. The only solution I have come up with to this point is to give each submit button a different property and then check which one is not null. I am fairly certain there are better solutions, and I am not even sure if what I have proposed will work.

Any thoughts/advice would be appreciated.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try using LookupDispatchAction, and use the ApplicationResources file for the value of your submit buttons. By doing this, you can change the way your submit buttons are displayed without changing the logic in your Action class.

For more information on how to use LookupDispatchAction, seethis link.
 
A knibbs
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the link. I was looking at that and didn't understand it and continued to work until I had something that at least made sure I could do what I wanted. I think that is going to fall into the beautification process that will happen in the very near future. There are other components that I want to ensure will at least work before I come back to making it work perfectly. I hope you don't mind if I bring this topic back up in the future.

thanks again for the link, it's nice to know that I was looking at something that was on the right track (even if I didn't use it off the hop ).
 
    Bookmark Topic Watch Topic
  • New Topic