File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Specifying Object Type in Tag Body Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Specifying Object Type in Tag Body" Watch "Specifying Object Type in Tag Body" New topic

Specifying Object Type in Tag Body

Alec Lee
Ranch Hand

Joined: Jan 28, 2004
Posts: 569
We can specify a rtexpr attribute, say, ${m} which evaluates to some non-String object type, in the body of a tag - instead of inside the tag e.g.

copied from HFS P446, assuming person is a Map. Or, using <jsp:attribute>

assuming the tag file does accept an attribute with rtexprvalue.

In both cases, the attribute of tag is specified in the body. However, when I tested it out myself in tomcat 5.0.29, I noticed that the type of the expression is always converted to String if it is specified in the body - while it remains as the original non-String object if you put it inside the tag. I don't understand why this is the case. I suppose the two ways should produce the same result.

Also, the first question of p447 of HFS says the body version of <c:set> is the same as the non-body version. So, I just want to verify if anybody got the same result. Am I making some mistake?
I agree. Here's the link:
subject: Specifying Object Type in Tag Body
It's not a secret anymore!