Type Coercion"
From Documentation
m |
m |
||
Line 34: | Line 34: | ||
| (char)0 | | (char)0 | ||
| 0 | | 0 | ||
− | | obj | + | | "" (obj) |
|- | |- | ||
| null | | null | ||
Line 52: | Line 52: | ||
<references/> | <references/> | ||
</blockquote> | </blockquote> | ||
+ | |||
+ | * The handling of an empty string and null is the same | ||
=Version History= | =Version History= |
Revision as of 02:41, 8 December 2010
EL expressions will coerce the type automatically. Here is the summary of the coercion rules.
Boolean | Character | Number | String | |
---|---|---|---|---|
Boolean | obj[1] | ERROR | ERROR | obj.toString() |
Character | ERROR | obj | (short)obj | obj.toString() |
Number | obj | ERROR | (char)obj | obj.toString() |
String (not empty) | Boolean.valueOf(obj) | obj.charAt(0) | Number[2].valueOf(x) | obj |
String (empty) | false | (char)0 | 0 | "" (obj) |
null | false | (char)0 | 0 | "" |
Other | ERROR | ERROR | ERROR | obj.toString() |
- The handling of an empty string and null is the same
Version History
Version | Date | Content |
---|---|---|