jQuery in Action, 3rd edition
The moose likes JSF and the fly likes Customizing >h:message< Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Customizing &gt;h:message&lt;" Watch "Customizing &gt;h:message&lt;" New topic

Customizing &gt;h:message&lt;

Bernhard Slominski

Joined: Nov 03, 2004
Posts: 10

I want to customize the <h:message> tag for displaying form validation error messages:
So e. g.

I want to print the error message "Required field: Firstname"
I can change the message in the resource bundle, but how can I add "Firstname" to the message?

Thanks for your help!

Jeremy Wilson
Ranch Hand

Joined: Feb 18, 2003
Posts: 166
I believe you will need to create your own custimized JSF tag library to do that. You could start with the code from a library like myfaces and modify to your liking.

Jeremy Wilson
Kant P.

Joined: Apr 12, 2005
Posts: 11
there are 4 things you have to create:
1) create an output text
2) create a request scope of type java.lang.string
3) bind this request scop to output text you just created
3) when a login fails, do this:
getRequestScope().put("name of request scope", "Required field: " + newCustomer.firstName)

Follow those step should do it!!!1 good luck
I agree. Here's the link: http://aspose.com/file-tools
subject: Customizing &gt;h:message&lt;
It's not a secret anymore!