jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Lenz <cml...@gmx.de>
Subject Re: iterative tag with nested tags example
Date Sun, 09 Mar 2003 16:51:07 GMT
Ian Kallen wrote:
> Hi Vincent,
> On Sun, 9 Mar 2003, Vincent Massol wrote:
>>- Have you had a look at
> Yes, I guess what's unclear is how to setup the tag hierarchy in the
> setUp() phase so that when you do pageContext.pushBody() inside your loop
> you're getting the interior tags evaluated.  The simple cases are fine, it
> seems like when the tag has a body _and_ the body is iteritively
> evaluated, the game gets a little hazy.

I'd really recommend you to look at JspTagLifecycle helper :-)
Actually, the reason I've written it in the first place was that I found 
testing iteration tags too hard and error-prone.

Here's an example that tests whether the JSTL forEach-Tag exports a 
scoped variable as expected:

   ForEachTag tag = new ForEachTag();
   JspTagLifecycle lifecycle = new JspTagLifecycle(pageContext, tag);
     "Item", new Object[] {"One", "Two", "Three"});

Simple, no? More advanced tests are possible, too. The Javadoc of the 
class is the best reference ATM.

>>- Also, there's a new JspTagLifeCycle class in Cactus 1.5 to help unit
>>testing taglibs. The best doc for it is in the cactus servlet sample.
>>Here's the test suite for JspTagLifeCycle:
> Sounds good.
> How soon is 1.5 going into release?  It looks like the nightlies are
> building with various levels of completeness, not sure which one I should
> work with.

The more recent ones (2003-03-08 and later) should be pretty safe to 
check out.

I'd be quite interested in some feedback about the JspTagLifecycle 
class. Haven't heard much yet :-(

Christopher Lenz
/=/ cmlenz at gmx.de

View raw message