File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes RTExpr Attribute Value Given in Tag Body Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "RTExpr Attribute Value Given in Tag Body" Watch "RTExpr Attribute Value Given in Tag Body" New topic
Author

RTExpr Attribute Value Given in Tag Body

Alec Lee
Ranch Hand

Joined: Jan 28, 2004
Posts: 569
Sometimes tag attribute value could be specified in the tag body e.g.

can becomes


Or thru the use of <jsp:attribute>

becomes


However, in tomcat 5, if the value is a non-String rt expression, a Rt expression given in the tag body (the second versions above) is toString'ed and the attribute just receives a String instead of an Object type. Is this a behavior defined in spec? I just cannot locate explicit info in the spec saying this but it seems to imply this behavior. Could anyone clarify this. Thanks
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1016
I think it is more implied than stated anywhere.
Anything that is template text, gets output to a writer - it has to be converted to a string.
Values in an attribute are not template text, so obviously do not get automatically converted.

Check out section JSP1.3.6 of the JSP2.0 specification.
It has an example showing that whatever is nested between tags is template text. It also details the <jsp:attribute> tag, which I admit I have never come across before.

Hope this helps,
evnafets
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: RTExpr Attribute Value Given in Tag Body
 
Similar Threads
problem on c:set
Specifying Object Type in Tag Body
Why <c:set var=..></c:set> will not accepts <jsp:attribute> inside the body
TLD files variable element
Doubt in jsp:attribute