我有自定义标签。它可以正常工作,但一点也不起作用。我的jsp看起来像:

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


其中${headHunter.salary}是一些值。和标签:

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


因此,如果${headHunter.salary}等于10,则标记必须返回相同的值。但是它只将"${headHunter.salary}"作为字符串还原。怎么了?

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>

最佳答案

摆脱

<bodycontent>tagDependent</bodycontent>


它应默认为scriptlessIt seems tagDependent prevents EL from being resolved

09-09 17:34