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: d...@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-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to