You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by William Shulman <wi...@metaconsortium.com> on 2001/06/12 03:52:10 UTC

question

Inside of the logic:iterate tag, I am passing a string to an xsl
tranformer, using pageContext.out as the writer the tranformer will
write its results to. When I do so, there is a complaint that says:

"Illegal to flush within a custom tag"


I tried to do the same thing (use an xsl tranformer) inside of some
custom tags I have written and I get no such error -- I only get the
erro inside of the login:iterate tag.

Does anyone know if there is soem reason this might be happening
inside the iterate tag? I have been banging my head against the wall on this
one.

I cant find what code is complaining and I thought you struts guys may
have an idea since I can only reproduce in the iterate tag.

thanks much in advance

-will

Re: question

Posted by William Shulman <wi...@metaconsortium.com>.
Thanks Oleg

Oleg V Alexeev writes:
 > Hello William,
 > 
 > Can you wrap iterate tag with xsl transformer and process whole
 > result? Or use xsl tags from taglibs project?
 > 

This will not be possible. Basically, I have a Hashtable of objects
that each have a property that is an XML string. I want to iterate
over the Hastable's values and pass the XML string from each object to
a custom tag I have to render the XML with an XSL template.

 > At end of iterate tag there is bodyContent.clearBody() call. I think
 > it is reason for this exception and so you can not use any direct
 > manipulations with pageContext.out here.
 > 

Hmm, this seems like it could end up being a problem for many
people. I just looked at the code. I am not sure what clearBody() does
(I'm new to Struts), but if I understand you correctly, are you saying
that Custom tags, when invoked inside the iterate tag, may or may not
behave properly? I would think that tags should always behave in a
"context free" way just like any code in any language does. In Java,
you would barf if you saw a function that behaved differently based on
the the state of the caller. Imaging if suddenly Object.toString()
broke because you are calling it inside of a method that "did not
intend Object.toString() to be called withing its context". In this
case, I implemented my Tag after the iterate tag was implemented and
so MAYBE I can find a workaround. However, there might be many tags
out there that work perfectly but may break if used inside the iterate
tag.

Do you think there is a way for the struts team to fix this or am I
missing something and you do not think this is a bug.

thanks for you reply
-will



 > Tuesday, June 12, 2001, 5:52:10 AM, you wrote:
 > 
 > 
 > WS> Inside of the logic:iterate tag, I am passing a string to an xsl
 > WS> tranformer, using pageContext.out as the writer the tranformer will
 > WS> write its results to. When I do so, there is a complaint that says:
 > 
 > WS> "Illegal to flush within a custom tag"
 > 
 > 
 > WS> I tried to do the same thing (use an xsl tranformer) inside of some
 > WS> custom tags I have written and I get no such error -- I only get the
 > WS> erro inside of the login:iterate tag.
 > 
 > WS> Does anyone know if there is soem reason this might be happening
 > WS> inside the iterate tag? I have been banging my head against the wall on this
 > WS> one.
 > 
 > WS> I cant find what code is complaining and I thought you struts guys may
 > WS> have an idea since I can only reproduce in the iterate tag.
 > 
 > WS> thanks much in advance
 > 
 > WS> -will
 > 
 > 
 > 
 > -- 
 > Best regards,
 >  Oleg                            mailto:gonza@penza.net
 > 
 > 

Re: question

Posted by Oleg V Alexeev <go...@penza.net>.
Hello William,

Can you wrap iterate tag with xsl transformer and process whole
result? Or use xsl tags from taglibs project?

At end of iterate tag there is bodyContent.clearBody() call. I think
it is reason for this exception and so you can not use any direct
manipulations with pageContext.out here.

Tuesday, June 12, 2001, 5:52:10 AM, you wrote:


WS> Inside of the logic:iterate tag, I am passing a string to an xsl
WS> tranformer, using pageContext.out as the writer the tranformer will
WS> write its results to. When I do so, there is a complaint that says:

WS> "Illegal to flush within a custom tag"


WS> I tried to do the same thing (use an xsl tranformer) inside of some
WS> custom tags I have written and I get no such error -- I only get the
WS> erro inside of the login:iterate tag.

WS> Does anyone know if there is soem reason this might be happening
WS> inside the iterate tag? I have been banging my head against the wall on this
WS> one.

WS> I cant find what code is complaining and I thought you struts guys may
WS> have an idea since I can only reproduce in the iterate tag.

WS> thanks much in advance

WS> -will



-- 
Best regards,
 Oleg                            mailto:gonza@penza.net