Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Error handling in Struts

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have a JSP Page which has two dropdown fields. If the user selects something from first dropdown and doesn�t selects anything from the second dropdown, it displays me an error message saying �This field is required�. But now I have a scenario wherein, on selecting a particular value from first dropdown should not force the user to select something from the second dropdown (i.e he should be able to proceed even if he doesn�t selects anything from the second dropdown). How can I implement this is Struts ?

TIA,
Priya
 
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
Is your validation done in the form's validate method or is it done in the validation framework?
 
Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Priya,

Conditional cross-field validation like this is possible in Struts since version 1.1 which added the requiredif validator. This validation rule has been deprecated in favour of the new rule validwhen which has been added in version 1.2.0

For information and examples on using these validator rules check the Validator documentation on the struts site.

However, I think that these validators can be used only for server side validation, not client-side javascript validation.

Sheldon Fernandes

[Edit: I assumed you were talking about xml based validation provided by the validator framework]
[ September 29, 2004: Message edited by: Sheldon Fernandes ]
 
Priya Jotwani
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have validations in my validator.xml and have corresponding .properties file.
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic