tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Cavacas <john....@sapiens.com>
Subject RE: Recursion with JSTL tags
Date Fri, 02 May 2003 21:24:54 GMT
Well it works!

The problem was that I was passing the same category id back to the
recursive.jsp page in each iteration. What I had to do was declare a local
variable with the proper sub category id, and use that value to temporally
overwrite the category id. After I did that, I stopped getting errors, and
the entire tree is displayed.

Now I just have to figure out a way to proper indention.

John

> -----Original Message-----
> From: John Cavacas [mailto:john.cav@sapiens.com]
> Sent: Friday, May 02, 2003 4:59 PM
> To: 'Tag Libraries Users List'
> Subject: RE: Recursion with JSTL tags
> 
> Well,
> 
> I'm still going at it, I got it to successfully do one include inside a
> <forEach>, but the calling itself part actually crashes my container :)
> 
> Looks something like this:
> 
> <x:forEach select="$doc/categories/*" var="cats>
> 	.. parse some xml
> 	.. output some content
> 	<c:set var="kids">
> 		<x:out select="$cats/@haschildren"/>
> 	</c:set>
> 	<c:if test="${kids == 'true'}">
> 		<c:import url="recursive.jsp"/>
> 	</c:if>
> </x:forEach>
> 
> In recursive.jsp I have something similar, except the import is itself
> instead of another JSP.
> 
> <x:forEach select="$doc/categories/category[@parent=$catId]" var="subcat">
> 
> 	... do some work
> 	<c:if test="${kids == 'true'}">
> 		<c:import url="recursive.jsp"/>
> 	</c:if>
> </x:forEach>
> 
> That's where my container (WebSphere) just craps out and crashes.
> 
> I have a feeling it may have to do something with output buffering, but I
> don't think so if the first case works fine.
> 
> Thanks,
> John
> 
> > -----Original Message-----
> > From: Serge Knystautas [mailto:sergek@lokitech.com]
> > Sent: Friday, May 02, 2003 4:44 PM
> > To: Tag Libraries Users List
> > Subject: Re: Recursion with JSTL tags
> >
> > John Cavacas wrote:
> > > Hi,
> > >
> > > This may seem like a silly question, but I was wondering if there was
> a
> > way
> > > to achieve recursive behavior out of the core and xml tags.
> >
> > JSTL prevents this in the sense that everything has to be an XML tag...
> > there's no go to or self-referencing, so loops start and end.
> >
> > I think you're on the right track with having a include of yourself.  I
> > vaguely remember that according to comp sci theory you can write
> > recursive logic without being recursive, but how you do that has long
> > since left my brain.
> >
> > --
> > Serge Knystautas
> > President
> > Lokitech >> software . strategy . design >> http://www.lokitech.com
> > p. 301.656.5501
> > e. sergek@lokitech.com
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
> 
> 
> 
> This communication is intended for the use of the individual(s) or entity
> it
> was addressed to and may contain confidential and/or privileged
> information.
> If the reader of this transmission is not the intended recipient, you are
> hereby notified that any review, dissemination, distribution or copying of
> this communication is prohibited.  If you receive this communication in
> error, please notify the sender immediately and delete this communication
> from your system(s) to which it was sent and/or replicated to. (c) 2002
> Sapiens Americas Corp.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org



This communication is intended for the use of the individual(s) or entity it
was addressed to and may contain confidential and/or privileged information.
If the reader of this transmission is not the intended recipient, you are
hereby notified that any review, dissemination, distribution or copying of
this communication is prohibited.  If you receive this communication in
error, please notify the sender immediately and delete this communication
from your system(s) to which it was sent and/or replicated to. (c) 2002
Sapiens Americas Corp.

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Mime
View raw message