Assuming myMap is a java.util.Map with String as key and Object as value. Are they 100% equivalent?
I tested it with tomcat5.0 and it seems that the EL inside a tag body is converted to String first before assigned to the map. Is there any way to preserve the original type of myObject while using the version with a body? [ September 05, 2005: Message edited by: Bear Bibeault ]
No. When an EL expression is used in template text, its behavior is to be evaluated, that value converted to string, and then emitted to whatever writer is in scope at the moment -- in this case, the writer for the tag body. By the time the tag gets the body context, the value has been been long ago converted.
Also note that the whitespace within the tag body -- line terminators and indentation -- are included as part of the tag body in your second example. [ September 05, 2005: Message edited by: Bear Bibeault ]