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 JSF and the fly likes JSF validator problem 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 » Java » JSF
Bookmark "JSF validator problem" Watch "JSF validator problem" New topic
Author

JSF validator problem

Gina vernon
Ranch Hand

Joined: Jan 16, 2009
Posts: 108
Hi,
I am trying to practice implementing the validator interface to validate an inputSecret UIcomponent. And I can't get it to work.

Here is my class that implements the validator:



This is the class with the setter&getter methods for the password:


the related JSF code:


and faces.cofig:


On a related note, i have read a lot of articles that call the validating class a 'backing bean'. How is it different from a 'managed bean'. And why is it called a bean when it doesn't have any set/get methods?

Thanks.

Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Gina vernon wrote:Hi,
And I can't get it to work.

Elaborate the problem in detail. What happens? What happens not?
On a related note, i have read a lot of articles that call the validating class a 'backing bean'. How is it different from a 'managed bean'. And why is it called a bean when it doesn't have any set/get methods?

The validator class is not a backing bean class. Either the article is wrong or you misinterpreted the article.

To the point, a backing bean is a java class which can be managed by JSF as managed bean. A managed bean is a backing bean instance which is been managed by JSF.
Gina vernon
Ranch Hand

Joined: Jan 16, 2009
Posts: 108
Bauke Scholtz wrote:
Elaborate the problem in detail. What happens? What happens not?


My validator implementation does not validate my password when the length of the password is less than 5. It goes through to a welcome page. I expect it to print the error message I specified in the implementation class.
Thanks.
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Please analyze the problem at developer's level, not at user's level. The situation at the user's level is clear enough for us, developers.

Do the validator method for instane get executed? Does the string reference 'passw' contain the expected value? Are all the JSF phases executed? Etcetera. Debug your code and see what happens and what not. What lines got executed according expectations and what not. That kind of things.
Gina vernon
Ranch Hand

Joined: Jan 16, 2009
Posts: 108
I found the solution! There is nothing wrong with the code as it turns out, so its not a developer level issue. Its more a page designer issue. I needed to put this tag in to the JSP:
.





Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
So your validator actually does validate the input and does add the message, but the message doesn't show up.

Glad you solved it yourself.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JSF validator problem
 
Similar Threads
Jsf Data table values are coming as null
JSF 2.0 cannot rech out-come page
Beginners Querylogue!
Could not navigate from one page to another !!!
problem JSF - datatable from DB