You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2009/03/26 14:49:36 UTC

DO NOT REPLY [Bug 46920] New: EL resolver does not call (overridden) Enum.toString() method

https://issues.apache.org/bugzilla/show_bug.cgi?id=46920

           Summary: EL resolver does not call (overridden) Enum.toString()
                    method
           Product: Tomcat 6
           Version: 6.0.18
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Jasper
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: dju@elegiac.net


I have created my own enum MyEnum which override the toString() method.

If I set an attribute of type MyEnum with name "foo" in the page context, and
use the EL ${foo} in a JSP page, Enum.name() is used instead of Enum.toString()
to render the enum instance, thus displaying the enum constant name instead of
the enhanced description String returned by MyEnum.toString().

It seems the expectedType argument is String instead of Enum in the
org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate() method.

A possible workaround is to create the following method in the enum:

public final String getToString() {
    return toString();
}

and use ${myEnum.toString} in JSP pages, which is undesirable.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 46920] EL resolver does not call (overridden) Enum.toString() method

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46920


Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID




--- Comment #1 from Mark Thomas <ma...@apache.org>  2009-04-08 03:31:31 PST ---
The current Tomcat behaviour is as per section 1.18.2 of the 2.1 JSP-EL spec.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org