Originally posted by Francesco Marchioni:
Hi all,
I'd like to use tag files to build some templates in my web pages.
My problem is that I need to pass variables at runtime
Unfortunately I cannot use standard jsp <%=myvar%> notation like this:
<% String myvar="blabla"; %>
<tags ageHeading title="<%=myvar%>" />
So which is the correct way to pass runtime parameters to tag files?
Thanks a lot
Francesco
Hi Francesco,
if you are using custom taglibs, then in the tld file , you can specify rtexprvalue = true for that parameter
eg.
<tag>
<name>TextInput</name>
<tagclass>blah.web.taglib.TextInputTag</tagclass>
<bodycontent>JSP</bodycontent>
<info>Writing text inputs</info>
<attribute>
<name>name</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
with this tld , in jsp i have statements like
<% String myName = "Abhimanyu" ; %>
<html:TextInput name="<%=myName%>" />
Hope this helps,
Abhimanyu