Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Displaying custom messages in JSF  RSS feed

 
Subrahmanyam Baratam
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
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.

<application>
<message-bundle>com.mir.registration.i18n.MyErrors</message-bundle>
</application>
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.

Thanks,
Subrahmanyam.
 
Victor Bucutea
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 ,
victor
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!