• 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 ...
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

Displaying custom messages in JSF

Posts: 13
  • Mark post as helpful
  • send pies
  • 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
  • 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 ,
Hey! You're stepping on my hand! Help me tiny ad!
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!