Chris Wilson wrote:

> hello,
>
> i've run into a snag using the <bean:write ... /> tag in jrun 3.0 sp1.
>
> when i set the ignore attribute to true i get a servlet error from jrun that
> there's no method matching setIgnore(java.lang.String) in the write tag.
>
> so i looked at the source of the servlet that jrun compiled from my jsp, and
> sure enough, it had a call like this: tag.setIgnore("true");
>
> of course this fails since the method signature of setIgnore takes a native
> boolean.
>
> when i run the same page on tomcat, jasper compiles the same thing to:
> tag.setIgnore(true); which is correct (at least it works!).
>

Yep ... this is correct.

>
> which compiler is right by the spec? tomcat or jrun?  it looks like tomcat
> is introspecting the tag to see what the method signature is, and doing the
> "true" -> true translation for me.
>
> i'm just curious if the jrun compiler is just lazy, or if the struts tags
> have been written to take advantage of some tomcat "magic" that seems to be
> affecting their portability?
>

In JSP 1.1, the set of type conversions that a JSP page compiler does for a
<jsp:setProperty> tag are identified in Table 2.4, on page 65.  In particular,
if the property is boolean, the compiler converts the string value you specify
to a boolean, according to the rules of the java.lang.Boolean.valueOf(String)
method.

The spec was not originally clear that these rules applied to custom tags as
well -- however, this was clarified in "Issue 7" of the JSP 1.1 Errata published
at:

    http://java.sun.com/products/jsp/errata_1_1_a_042800.html

and is more clearly spelled out in the JSP 1.2 Proposed Final Draft.

It is definitely not Tomcat "magic" :-), any more than the conversion for
integer, long, float, or double attributes would be.

>
> forgive me if this topic has been discussed before, i forgot where the
> archive was, and wasn't able to search for this issue.
>

I don't believe this one has been addressed on STRUTS-USER, although I think
I've seen it a couple of other places.

>
> thanks for any insight.
>
> cheerio,
> chris
>
> | chris wilson || web dev ||| [EMAIL PROTECTED] || | www.wondergeek.com |
> |

Craig


Reply via email to