This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes jsf and validation 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 » Frameworks » Struts
Bookmark "jsf and validation" Watch "jsf and validation" New topic
Author

jsf and validation

Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8904

Does JSF have components to validate user entered values?


Groovy
Varun Khanna
Ranch Hand

Joined: May 30, 2002
Posts: 1400
Yes, in fact jsf life cycle has an entire phase for performing the validation.
Check out this link
[ December 14, 2004: Message edited by: K Varun ]

- Varun
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8904

Hello Varun,

You are an JSF expert.

What implementation and tools are using for developing JSF?
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8904

Here is a chapter on validation
http://www.cs.sjsu.edu/faculty/horstman/corejsf/geary-horstmann-corejsf-chapter6.pdf
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Validation is a heck of a lot simpler with JSF than with Struts. However, Sun's RI doesn't provide any client side validation. So everything goes to the server. Other vendor implementation may provide validators for client side validation.

You can validate simply using the faces taglib like:



You can also call a method in your backing bean to do the validation:



For the standard validators that's all there is to it. You don't have to maintain any other files (like struts validator XML file(s)).
[ December 15, 2004: Message edited by: Gregg Bolinger ]

GenRocket - Experts at Building Test Data
Varun Khanna
Ranch Hand

Joined: May 30, 2002
Posts: 1400
Originally posted by Pradeep Bhat:


What implementation and tools are using for developing JSF?


WSAD 5.1.2 & RI 1.1
Cay Horstmann
author
Ranch Hand

Joined: Nov 14, 2004
Posts: 114
    
  10
Core JSF has a section on using the JavaScript in Struts Validator for client-side validation. That way, you don't have to write and debug your own JavaScript.

Cheers,

Cay


Author of Java 8 for the Really Impatient
Varun Khanna
Ranch Hand

Joined: May 30, 2002
Posts: 1400
Originally posted by Cay Horstmann:
Core JSF has a section on using the JavaScript in Struts Validator for client-side validation. That way, you don't have to write and debug your own JavaScript.

Cheers,

Cay


Hey Cay,
Welcome to Javaranch !!!

Will you advocate doing client side validations in JSF? Can you please quote some example/scenarios for the same and the advantage it will provide over the server side validations.

Thanks,
 
 
subject: jsf and validation
 
Similar Threads
JSF 1.1 or JSF 1.2
DataTable,DataGrid and Databindings in JAVA.
Accessing bean data within a scriptlet
JSF: simple "required" validation problem
Spring+ hibernate or JSF+EJB3