• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

When Dot or [ ] Throw Exception

 
P. Dunn
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since there's lots of questions scattered:
According to the Spec.
El dot only throws Exception if myBean and myBeanProperty are not null, but getMyBeanProperty() doesn't exist in MyBean Class.
(Also if Exception thrown by getter itself)

This is only a problem for beans.


Sorry, the arrangement of the list isn't clear here. See the spec.
JavaServer Pages 2.0 Specification
General Syntax of the Expression Language
pp 1-68

[ February 23, 2005: Message edited by: P. Dunn ]
 
Ranjit Jana
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mr Dunn,
That is a useful information.

Here I assume all the values which are evaluated as null will be outputted to JSP as empty value ""

Now look at the quote from above.
--------------
� Otherwise (a JavaBeans object), coerce value-b to String
- If value-b is a readable property of value-a as per the JavaBeans specification:
- If getter throws an exception: error
- Otherwise: return result of getter call
- Otherwise: error.
------------
This means that there is only two possibility available with JavaBeans . either return getter value or throw error.
In case value-a is null then the return value will be null.(thats the third option )
 
P. Dunn
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ranjit Jana:
Mr Dunn,
That is a useful information.
...This means that there is only two possibility available with JavaBeans . either return getter value or throw error.
In case value-a is null then the return value will be null.(thats the third option )


If either a or b are null you get null back.

(How'd you know I was Mr. Dunn?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic