Hello,

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) {
        System.out.println(value);
    }

    @Override
    public void setPageContext(PageContext pc) {
    }

    @Override
    public void setParent(Tag t) {
    }

    @Override
    public Tag getParent() {
        return null;
    }

    @Override
    public int doStartTag() throws JspException {
        return SKIP_BODY;
    }

    @Override
    public int doEndTag() throws JspException {
        return EVAL_PAGE;
    }

    @Override
    public void release() {
    }

}

My TLD:

<?xml version="1.0" encoding="UTF-8" ?>
<taglib xsi:schemaLocation="http://java.sun.com/xml/ns/javaee web-
jsptaglibrary_2_1.xsd" xmlns="http://java.sun.com/xml/ns/javaee"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; version="2.1">
    <tlibversion>1.0</tlibversion>
    <uri>http://my-domain.org/customLib</uri>
    <tag>
        <name>customTag</name>
        <tagclass>mypackage.MyCustomTag</tagclass>
        <bodycontent>empty</bodycontent>
        <attribute>
            <name>value</name>
            <required>true</required>
            <rtexprvalue>true</rtexprvalue>
        </attribute>
    </tag>
</taglib>




And in my JSP file is use it:

<%...@taglib prefix="myLib" uri="http://my-domain.org/customLib"%>

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

I would expect, that this outputs:

VALID
foo.VALID.bar


The output in catalina.out is very interesting:

VALID
foo.VALID result, code 0.bar


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


Bye

Oliver

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to