aspose file tools*
The moose likes JSF and the fly likes Replace the ELException with a more meaningful description Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Replace the ELException with a more meaningful description" Watch "Replace the ELException with a more meaningful description" New topic
Author

Replace the ELException with a more meaningful description

Lyndon Tate
Greenhorn

Joined: Aug 10, 2009
Posts: 2
Does anybody know if it is possible to replace the ELException with a more meaningful description?

Background Info: I have a text field which accepts input and validation stops users entering a certain length. If this is accepted further checking occurs during the binding of the entered data to the data model. At this point an exception is thrown providing a description of the problem. However JSF always reports an ElException:

javax.faces.el.EvaluationException: javax.el.ELException: Error writing 'amountScreen' on type com.essentis.datamodel.ejm.MainFee

Is there anyway of replacing this error message with a more meaninfull error message? Is there something similiar to JSF converter messages. Like the one for INTEGER?
javax.faces.converter.IntegerConverter.INTEGER=Must be a numeric consisting of one or more digits.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16250
    
  21

Welcome to the JavaRanch, Lyndon!

Normally you'd get that error when the property referred to in the EL isn't defined in accessible way. For example, if the setter/getter has an improper signature, such as not being defined as "public". Alternatively, it could indicate that the backing object cannot directly handle the conversion to/from a display string (in which case you probably need to define a property whose mutators can do the required translations).

You shouldn't get ELExceptions for invalid data, only for actual programming errors. So there shouldn't be a need to override the message. I'm fairly sure you can override the message, as far as it goes, but like I said, it's a symptom of a bigger problem, so I wouldn't bother.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Replace the ELException with a more meaningful description