tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Siegmar <>
Subject Re: Inconsistent output of Java 5 enums
Date Fri, 15 Oct 2010 17:28:38 GMT

Am Friday 15 October 2010 schrieb Maximilian Stocker:
> > > Or, just consistently use EL, since that actually works as you expect.
> > 
> > +1  '<c:out' seems surplus.
> And how do you escape XML characters to entity codes using pure EL?
> This seems a valid reason except that is this a problem for your enum?

As stated before, it was just a simplified example.

> If it really is a problem then did you try and create a new getter method
> that returns your to string content in the enum? And then call that with
> c:out.

The enum is part of a 3rd party lib. And of course, there are several 
workarounds available, but I want to understand what is happening here and 
clearify if it's a bug.

And it's not just the c:out tag - it also happens with other Tags. For 
demonstration I've created a custom Tag:

public class MyCustomTag implements Tag {

    public void setValue(String value) {

    public void setPageContext(PageContext pc) {

    public void setParent(Tag t) {

    public Tag getParent() {
        return null;

    public int doStartTag() throws JspException {
        return SKIP_BODY;

    public int doEndTag() throws JspException {
        return EVAL_PAGE;

    public void release() {



<?xml version="1.0" encoding="UTF-8" ?>
<taglib xsi:schemaLocation=" web-
jsptaglibrary_2_1.xsd" xmlns="" 
xmlns:xsi="" version="2.1">

And in my JSP file is use it:

<%@taglib prefix="myLib" uri=""%>

<myLib:customTag value="${myEnum}"/>
<myLib:customTag value="foo.${myEnum}.bar"/>

I would expect, that this outputs:


The output in catalina.out is very interesting:

foo.VALID result, code

Remember, VALID is the enum name() and "VALID result, code 0" is the enum 
toString(). I think that is REALLY weird...



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message