我想写一个自定义选项卡的属性,但我不能让标签处理程序类读取属性值。使用<%= %>
,我可以得到objValue的工作。但是当我使用${}
时,objValue2
未被评估。自定义标签开发 - 属性不工作
的jsp:
<% CommitmentItem ci = (CommitmentItem) request.getAttribute("commitmentItem"); %>
<myTag:calPOP objValue="<%= ci.getSource() %>" objValue2="${commitmentItem.source}" > </myTag:calPOP>
标记处理程序:
<getters & setters here>
public int doStartTag() throws JspException {
pc.setAttribute("objValue2", objValue);
System.out.println("Object Value = " + objValue);
System.out.println("Object2 Value = " + objValue2);
控制台输出:
Object Value = Contract W23AG-23
Object2 Value = ${commitmentItem.source}
coderanch解决方案的工作,但我碰到了使用th的另一个障碍是我最终试图实现的目标,这里记录了here – jeff 2010-08-26 18:45:29
或者如果您试图获得自定义标记文件,请在标记顶部放置<%@ tag isELIgnored =“false”%>“文件。 – undefined 2013-04-18 00:32:16