Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Customizing >h:message<

 
Bernhard Slominski
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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!

Bernhard
 
Jeremy Wilson
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Kant P.
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic