• 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 ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

Displaying custom messages in JSF

Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using jsf validation and the issue is, when i used required attribute for the jsf component the default message(Validation Error: Value is required)is getting displayed, instead of this message i need to display my own custom message, to overcome this I have taken one propertie file and
added the below line, and added the property file in faces config file,

javax.faces.component.UIInput.REQUIRED = Entry is required.

and this is working fine,

But here the problem is, i need to display the message,
forexmp: For user text box --->Message is ---> User Entry is required
For Password Password Entry is required
For designation Designation Entry is reuired

in the same way for the other fields,

Is there any solution for this issue.

Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well at first you will put an :

<h:message styleClass="validationMessages" for="tipPersoanaRadio" />

tag where you would like the message to appear , configure a validator in faces-config.xml ,and then write a validator class which will set the summary of the message like this :

where my ValidatorMessageUtil is something like :

Have fun ,
No one can make you feel inferior without your consent - Eleanor Roosevelt. tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
    Bookmark Topic Watch Topic
  • New Topic