aspose file tools*
The moose likes JSF and the fly likes Costom validator with domain object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Costom validator with domain object" Watch "Costom validator with domain object" New topic
Author

Costom validator with domain object

Shaiju scientia
Greenhorn

Joined: Jan 17, 2006
Posts: 15
Hi,
I have domain object Emloyee and through a UI the user enters the values for this domain object.
I want to validate the values entered by the user.
Now the scenario is , i wan to validate a particular attribute based on another attribute of the same domain object.
say I have a boolean attribute "isAvailable" in my domain object, this is set by the user by selecting check box .
Now I want to validate another attribute called "salary" based on the attribute "isAvailable" .

Any Idea how, can I achieve this.

My design is like this

1) Create a custom validater
2) Define an attribute Employ emp in the custom validater (Not sure whether this is right)
3)implement validate method and use the emp object to performe the validation

But problem is step 2 outsource. Is there a way I can inject the object into the validater?
Can anybody suggest ?

Thanks in Advance
Shaiju
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15639
    
  15

I did something similar when I did a password double-check validator. I couldn't inject, but I did make the validator look for the named pair control by searching the JSF object tree inside the validation method.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Costom validator with domain object
 
Similar Threads
How to write our own validator class using struts 1.x
Custom Clone and garbage collection
How to sort different attributes in Vector?
hast table and unlimited looping
validate an excelsheet entries using java code