> First of all, would this not leave the bean in an 
> incomplete state, it would have the ID, SerialNumber 
> and InService properties set, but not the OutService 
> date.  Is this not a bad thing?
It's not inheritly bad that some attributes get set and others don't,
but to prevent some valid data not making it into the bean, you could
try a different process. Just some code off the top of my head...

trimaBean.setID(from.trimaID);
trimaBean.setSerialNumber(form.SerialNumber);
trimaBean.setInService(form.InService);
trimaBean.setOutService(form.OutService); 

if ( arrayLen(trimaBean.invalidData) gt 0 ) 
        // throw an error here, or display an error on the page
        // and stop processing more rules

So in every set method, if there was an error, you add the message/code
to the invalidData array, and when you're all done calling the set
methods, check to see if any were invalid.  You wouldn't need to branch
the code, or store bad data, that's the whole point.  Bad data never
makes it into the bean.  The attribute would remain blank/0 until valid
data was entered.

Then you would simply repopulate the form with the bean data which would
leave invalid fields blank with a message on the screen explaining to
the user which ones he/she needs to fill again.


Steve "The Boss" Brownlee
http://www.orbwave.com/cfjboss

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:240793
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to