tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rachel Greenham <rachel.green...@enetgroup.co.uk>
Subject Using expressions in tag attributes
Date Tue, 15 Aug 2000 12:08:12 GMT
Should I be expecting this sort of thing to work?

<%
String name="wibble";
%>
<myprefix:GetVariable name="<%=name%>"/>

ie: using an expression in an attribute to a taglib tag. It doesn't 
work, and I think I can see why, but as it does on HTML it would be 
intuitive if it did.

Or is there another way of doing what I'm trying to do. Say for instance 
I wanted to use this to list all variables:

<table>
<%
Iterator i = myobj.getVariableNames();
while (i.hasNext()
{
String name = i.next().toString();
%>
<tr><th><%=name%></th><td><myprefix:GetVariable name="<%=name%>"/>
<%
}
%>

Actually, on reflection it looks like a bit of an ugly mix - if I'm 
putting that much Java in anyway, I may as well not be using the tag to 
get the variable, just <%=myobj.getVariable(name)%>, or write another 
tag for looping through variables.

-- 
Rachel


Mime
View raw message