• 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 2 required validator

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I have read in the struts documentation about 2 validators required and requiredstring.

The required validator checks whether a field value is null.

The requiredstring validator checks whether a field value is null and also whether the field value is empty.

So the required validator will not find any error if a blank value is passed as the field value but requiredstring validator will not allow blank value to be submitted.

I have the following doubt: If the required validator is anyway going to allow blank values to be submitted what is the use of this validator? Suppose I have a field named userName where the required validation is carried out.

<field name="userName">
<field-validator type="required">
<param name="trim">true</param>
<message>Username must not be null</message>
</field-validator>
</field>


Under what circumstances will I get an error message?

Regards,
John

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic