• 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 Validator

 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,
Am using the struts validator for an application

Can i have the error messages in one properties file and labels in another?
For example


My ErrorMessages.properties file consists of the following
errors.required = Please enter valid {0}

My Labels.properties file consists of the following
label.UserID = User ID

The struts config is set up as


Am accessing the html:errors as <html:errors bundle="Errors">

How do I associate the label.UserID with my error message.
I tried the following method

It doesnt work.

Any inputs?

 
Thara Visu
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any inputs on this topic... Guys It would be a great help
 
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No real input from me...I have never used the bundle attribute of the html:errors tag. It looks like it does not support pulling messages from one resource bundle and field names from another bundle. My guess is that you will have to include these both in the same resource bundle.

- Brent
 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<form-validation><formset> <form name="loginForm">
<field property="txtUserName" depends="required">
<arg0 key="label.UserID"/> # this u'r field Name


</field>
</form>
</formset>
</form-validation>

U'r ErrorMessages.properties file consists of the following
errors.required = Please enter valid {0}

check it out it will work

or reply to the post

by
dhana
 
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the same problem, too. The problem is not related to any tag. Rather, it is the <arg0 key="..."/> tag of validation.xml seems to search for the key in the default message resource only. I did search thru the DTD for the validation.xml and validator-rules.xml but there doesn't seem to be any tag allowing us to specify the message resource to use in the <arg0 key=> attribute.

Greatly appreciate any advice. Thx in advance.
 
Alec Lee
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just discovered that the problem has been solved in validator_1.2.dtd. Here, there is a bundle attribute for specifying which message resource to search for the key.
 
Thara Visu
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks All.
Alec, You told me wanted I really wanted. Thanks pal.
 
reply
    Bookmark Topic Watch Topic
  • New Topic