• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

JSF validator problem

 
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
"Don't believe every tiny ad you see on the internet. But this one is rock solid." - George Washington
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic