DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21709>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21709

<%= %> does not convert to string before passing arguments to custom tag handlers

           Summary: <%= %> does not convert to string before passing
                    arguments to custom tag handlers
           Product: Tomcat 4
           Version: 4.1.24
          Platform: All
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Minor
          Priority: Other
         Component: Unknown
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


This is a pretty obscure problem with a workaround, but to the best of my 
knowledge the error is a violation of the servlet/JSP spec so should be fixed.

I have a custom tag called <krm:action> and I am using the JSTL in this example.

<c:set var="title">
        <c:out value="${row.shortDesc}"/>
</c:set>
<krm:action display="link" type="componentNum" componentNum="PL-SITE-01" 
title="<%= pageContext.getAttribute("title") %>">
        <c:out value="${row.id}"/>
</krm:action>

The compiler complains as follows:

[ServletException in:/adminPicklist/siteList-body.jsp] Unable to compile class 
for JSP

An error occurred at line: -1 in the jsp file: null

Generated servlet error:
    [javac] Since fork is true, ignoring compiler setting.
    [javac] Compiling 1 source file
    [javac] Since fork is true, ignoring compiler setting.
    [javac] C:\jakarta-tomcat-4.1.24
\work\Standalone\localhost\ebspnp\adminPicklist\siteList_0002dbody_jsp.java:140:
 setTitle(java.lang.String) in com.bah.krm.taglib.util.ActionTag cannot be 
applied to (java.lang.Object)
    [javac]               _jspx_th_krm_action_0.setTitle( 
pageContext.getAttribute("title") );
    [javac]                                    ^
    [javac] 1 error

The simple workaround is just do a manual toString() as follows:

<c:set var="title">
        <c:out value="${row.shortDesc}"/>
</c:set>
<krm:action display="link" type="componentNum" componentNum="PL-SITE-01" 
title="<%= pageContext.getAttribute("title").toString() %>">
        <c:out value="${row.id}"/>
</krm:action>

But the toString() call should happen automatically, shouldn't it?  Isn't that 
part of the spec?

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to