jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gregory Seidman <gss+tag...@cs.brown.edu>
Subject when are tags executed?
Date Tue, 13 Aug 2002 16:40:09 GMT
I've been using JSP for a while, and Java for years and years, and I've
come to the conclusion that I need to write a special-purpose tag library
for my company's web app. I'm having trouble figuring out when the tag
implementation class is executed, and whether there is a way to spit out
JSP from a tag that needs interpreting as JSP.

The basic idea is that I want this...

<TABLE BORDER=1><TR>
<TH>ID</TH>
<TH>Value</TH>
</TR>
<mylib:mytag classname="com.foo.readdata.GetAllSomething" params="foo, 6">
	<TR>
	<TD><%= row.id %></TD>
	<TD><%= row.value %></TD>
	</TR>
</mylib:mytag>
</TABLE>

...to be interpreted equivalent to this...

<TABLE BORDER=1><TR>
<TH>ID</TH>
<TH>Value</TH>
</TR>
<% com.foo.readdata.GetAllSomething noncollidingvarname = new com.foo.readdata.GetAllSomething(foo,
6);
   while (noncollidingvarname.hasMoreElements()) {
   	com.foo.readdata.GetAllSomething.Row row = noncollidingvarname.nextRow();
	%>
	<TR>
	<TD><%= row.id %></TD>
	<TD><%= row.value %></TD>
	</TR>
<% } %><%-- while --%>
</TABLE>

The really important thing here is that while row is created by the tag,
the variable name "row" is only in the scope of the tag body, not the
entire page. I should be able to use mytag elsewhere and still refer to the
variable name "row" even if its type is different.

If I can spit out uninterpreted JSP which will be interpreted later, I can
clearly do what I want; that would require the tag implementation to run at
JSP compile time. If (as I suspect) the tag implementation is run at
execution time, then I need to be able to put the row variable in a limited
scope (and implement an IterationTag). Can it be done?

--Greg


--
To unsubscribe, e-mail:   <mailto:taglibs-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-dev-help@jakarta.apache.org>


Mime
View raw message