• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSF - Client Side validation

 
dwarakanathan thiru
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
Can any one please tell me how to perform a client side validation in JSF.
Please let me know the different options of client side validation in JSF.

In Struts we have a validation framework, likewise do we have any in JSF?
How about simple java script?

Thanks in advance!!
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18100
51
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The basic JSF tagset doesn't support client-side validation, only server-side validation. You can do your own client-side validation using JavaScript in the usual way, since the JSF controls all support the same attributes as their underlying HTML controls, including "onchange", "onblur" and so forth.

It's perfectly possible to create a JSF tagset that automatically generates this javascript as part of the HTML rendering, but I don't know of any tagsets that do that at the moment.

Just remember that client-side validation isn't sufficient to protect the app. You also need server-side validation if you want to avoid problems due to people hacking or because of errors in the client-side validation code.
 
dwarakanathan thiru
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cool!! That was informative. I am going to use the simple javascript in client side and server side.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic