and that is exactly what I am going to do!
thanks!

2007/9/19, Josh Canfield <[EMAIL PROTECTED]>:
> I had a similar problem. What I ended up doing was returning Object from the
> beginRender method and either returning the block parameter or using the
> writer and returning null.
>
> To simulate looping you can store your tokenizer in a page variable and
> return st.hasMoreTokens from afterRender, if it's false it will call
> beginRender again.
>
>   private StringTokenizer st;
>
>   @Parameter
>   private Block _blockParam;
>
>   void setupRender() {
>     st = new StringTokenizer(template, " ");
>   }
>
>   @BeginRender
>    final Object begin(MarkupWriter writer)
>    {
>                String token = st.nextToken();
>                if("TEST".equals(token))
>                {
>                    return _blockParam;
>                }
>                else
>                {
>                        writer.writeRaw(token);
>                }
>        return null;
>    }
>
>    @AfterRender
>    boolean after(MarkupWriter writer) {
>       return !st.hasMoreTokens(); // if it has more tokens go back to begin
>    }
>
>
> It doesn't fit for all cases, but something like that should work for the
> simple case you laid out...
>
> Josh
>
>
> On 9/18/07, Ted Steen <[EMAIL PROTECTED]> wrote:
> >
> > I would like to do this,
> >
> >    @BeginRender
> >    final void begin(MarkupWriter writer)
> >    {
> >        StringTokenizer st = new StringTokenizer(template, " ");
> >        while(st.hasMoreTokens())
> >        {
> >                String token = st.nextToken();
> >                if("TEST".equals(token))
> >                {
> >                        //TODO Render a block or component here!
> >                }
> >                else
> >                {
> >                        writer.writeRaw(token);
> >                }
> >        }
> >    }
> >
> > But I cant find anything in the api that lets me render a block or
> > component programmatically..
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> --
> --
> TheDailyTube.com. Sign up and get the best new videos on the internet
> delivered fresh to your inbox.
>


-- 
/ted

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to