When I try to use a custom JSP tag library, I have a variable defined in the JSP that I would like to evaluate before passing it to the tag library. However, I cannot get it to work. Here is a simplified version of my JSP:
<% int index = 8; %>
<foo:myTag myAttribute="something_<%= index %>"/>
doStartTag()My method TagHandleruses the pageContext output stream to write based on the attribute entered:
public int doStartTag() {
...
out.println("Foo: " + this.myAttribute);
}
However, the conclusion that I see in my last markup is as follows:
Foo: something_<%= index %>
instead of what i want:
Foo: something_8
Defining a library tag for an attribute:
<attribute>
<name>myAttribute</name>
<required>true</required>
</attribute>
I tried to configure the attribute rtexprvalueboth true, and so false, but did not work. Is there a way I can set up an attribute so that it is evaluated before being sent to the handler? Or do I completely disagree about this?
JSP-, . , , JSP , , .
Edit:
:
<foo:myTag myAttribute="something_${index}"/>
- something_${index}.