Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

<h:message /> Error message with JSF Code

 
Anand Gondhiya
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have following code:

All the examples I see on web or in the books says that when you hit on 'Register' button with no data entered in firstName text field , It would throw error right beside it. The error would read Validation Error: Value is required . But when submit above page, it shows j_id_jsp_172425500_1:fname: Validation Error: Value is required.. i.e it shows the generated code j_id_jsp_172425500_1:fname: as well !!
Has anybody come across such a sceneario. I am using JSF 1.2,JSTL 1.2 , Tomcat 6 , JDK 1.6

Thanks
-Anand
 
Walter Krawiec
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anand Gondhiya wrote:Hi,
I have following code:

All the examples I see on web or in the books says that when you hit on 'Register' button with no data entered in firstName text field , It would throw error right beside it. The error would read Validation Error: Value is required . But when submit above page, it shows j_id_jsp_172425500_1:fname: Validation Error: Value is required.. i.e it shows the generated code j_id_jsp_172425500_1:fname: as well !!
Has anybody come across such a sceneario. I am using JSF 1.2,JSTL 1.2 , Tomcat 6 , JDK 1.6

Thanks
-Anand


Maybe assign id for your message? I had problem with dynamic webuijsf:button, but after adding id to button everything works fine.

cheers

Walter
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18156
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The stock error message is really yucky. You can override it (it's a resource), but the override is done for all validation messages of that type, which is also yucky.

In newer JSF implementations, you can assign a label to the controls that will be used instead of the control ID when formatting the message.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic