我有自定义标签。它工作正常,但根本没有。我的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
,则tag必须返回相同的值。但它只将"${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>
答案 0 :(得分:1)
摆脱
<bodycontent>tagDependent</bodycontent>
它应该默认scriptless
。 It seems tagDependent
prevents EL from being resolved。