File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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: 16012
    
  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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: <h:message /> Error message with JSF Code