File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
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

Replace the ELException with a more meaningful description

Lyndon Tate

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: 17421

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.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: Replace the ELException with a more meaningful description
It's not a secret anymore!