*
The moose likes JSF and the fly likes <h:message />  Error message with JSF Code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "<h:message />  Error message with JSF Code" Watch "<h:message />  Error message with JSF Code" New topic
Author

<h:message /> Error message with JSF Code

Anand Gondhiya
Ranch Hand

Joined: Feb 24, 2004
Posts: 155
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

Joined: Jan 13, 2009
Posts: 20
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

Joined: Jun 25, 2001
Posts: 15960
    
  19

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: <h:message /> Error message with JSF Code
 
Similar Threads
Error With Simple Converter
JSF 1.2 doesn't display in IE 8
Can I supply a Bean in selectItem.setValue()?
Reloading JSF
message required