This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsf validation example

 
Mathew Lee
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I was running JSF validation example from the link

http://www.exadel.com/tutorial/jsf/jsftutorial-validation.html


I was not able to unserstand from where and how the error message got printed when you click the button by givin input text length less than 2 or greater than 10. Any ideas, links, sample code, resources highly appreciated. thanks in advance
 
Pankaj .k. Jain
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Error messages will be displayed where you have written the following command. This tag will show all messages for the components

<h:messages style="color:darkred"/>
 
Mathew Lee
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was not able to understand from where the text of the error message coming. I checked facess config as well as mesages files. None of them has the text. Does the it is showing default text message. If that is the case where can i find all those default text messages. Please advise
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18020
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The range validation error message template is contained within the validator's own source code, although you can provide overrides.

In the case of that particular error, the validator does a message Format operation to create a message from the template with the range constraints plugged in, then throws a ValidationException where the Exception message text is the message that was just created. The JSF framework catches it and adds it to the messages container and the JSF message elements select it and format it for display.
 
Mathew Lee
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>>>>The range validation error message template is contained within the validator's own source code,

where and how can i see all those messages within the validator's own source code
 
John Tannel
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could download the source code and look through it. Perhaps you could explain why you need to see the source code? There may be an easier solution to whatever you are trying to do.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic