Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

"Component Specific Custom Error Messages"  RSS feed

 
Sam Ferns
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

Need to set component specific custom error messages. For instance, if user name & adderss is mandatory then global custom messages such as:
1. Please enter 'User Name'
2. Address is missing / required.

By default the standard error message is displayed for all mandatory fields namely "Value is required.Enter Valid value."

How should such a functiomnality be implemented?

Thanks.

Cheers,
Savio
 
Marius Cloete
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Savio,

I am not sure if this is the best way do it, but it is wat I used.
The Validation Class is a Class that I created to do all my validation.



Hope this helps
Marius

[ February 13, 2006: Message edited by: Marius Cloete ]

[ February 13, 2006: Message edited by: Marius Cloete ]
[ February 13, 2006: Message edited by: Marius Cloete ]
 
ernest fakudze
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sam,

Also, those default JSF error messages can be overwritten in your resource bundles. For example, to overwrite the REQUIRED error message you can place this line in your bundle:

javax.faces.component.UIInput.REQUIRED=This field is required.

After a restart, you will see this message instead of the original.
HTH
 
Alex Nedelcu
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sam,

Unfortunately, as you can see, JSF is such a new framework that few have real experience with it.
I am also a newbie, and asked myself the same question.

You can implement custom messages by implementing a phase listener, as described in this article:
http://www.oracle.com/technology/pub/articles/masterj2ee/j2ee_wk7.html

I must say, I found the above answer in the following JSF FAQ:
http://www.jsf-faq.com/ (maybe it will help with other questions you may have
 
Sam Ferns
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

Thanks a lot for your inputs they have been helpful. Thanks Alex for the links. They have been of great help.

Thanks once again !!!

Cheers,
Sam
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!