Question

I've got custom tag. It works properly, but not at all. My jsp looks like:

<test:myTag>${headHunter.salary}</test:myTag>

Where ${headHunter.salary} is some value. And tag:

public int doAfterBody() throws JspException {
    String content = bodyContent.getString();
    try {
        JspWriter out = bodyContent.getEnclosingWriter();
        out.print(content);         
    } catch (Exception e) {
    }
    return SKIP_BODY;
}

So if ${headHunter.salary} equals 10, tag must return the same value. But it returs only "${headHunter.salary}" as string. Whats wrong?

UPD

taglib.tld:

<?xml version="1.0" encoding="UTF-8"?>
<taglib>
    <tlibversion>1.0</tlibversion>
    <shortname></shortname>
    <jspversion>1.1</jspversion>
    <tag>
        <name>myTag</name>
        <tagclass>net.babobka.blog.tags.CurrencyTag</tagclass>
        <bodycontent>tagDependent</bodycontent>
    </tag>
</taglib>
Was it helpful?

Solution

Get rid of

<bodycontent>tagDependent</bodycontent>

It should default the scriptless. It seems tagDependent prevents EL from being resolved.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top