aspose file tools
The moose likes JSF and the fly likes Setting Range validators on text fields through Managed Bean declarations Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "Setting Range validators on text fields through Managed Bean declarations" Watch "Setting Range validators on text fields through Managed Bean declarations" New topic
Author

Setting Range validators on text fields through Managed Bean declarations

Swapna Gouri Kalanidhi
Ranch Hand

Joined: Mar 14, 2008
Posts: 107
Hello Ranchers,

I'm new to JSF and trying to learn the concepts through examples. I have an application where I would like to validate the user input on a JSP page. I'm using validateLongRange tag to validate 3 fields. Each field is having a maximum and a minimum value and I want to fetch these values from the faces-config.xml

How do I declare the maximum and minimum ranges in the XML? As there are 3 fields, how to identify the max and min of each field in the XML? Is there a way out for this or do I need to hard-code the max/min values in the JSP page? Can anyone please help me in this regards?

Thanks!


Thanks & Regards
Swapna Gouri
I "try", I "catch" and "finally" WIN !!!
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 14491
    
    7

Faces-config wasn't really intended to be used that way. You can add new validators to the system using faces-config, but actual per-instance parameters are expected to appear on the items that actually use them.

You could kind of fake it by subclassing the standard validator, but since faces-config doesn't permit you to add arbitrary XML to itself, the actual values would need to be stored somewhere else.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Setting Range validators on text fields through Managed Bean declarations
 
Similar Threads
Validator for Java Beans
Struts2 Problem in validation
Session Timeout w/o xml?
Largest/Greatest of n numbers
Suggestions on database