Hi Geoff,

Supposedly, the condition is a bit complex that requires logic checking be done 
programmatically via code, eg. some business rules and database access to reach 
a decision on whether <PageLink A> should be rendered. Then, how should I code 
it in the renderComponent() body? What I am suggesting to do is have 
writer.begin("li") and then getComponent and render, finally writer.end(). But 
if this is the case, the static tags and content in the component template 
would be meaningless since I am producing it from writer.begin().

Any advise? I am not facing this scenario now, but I think I would be in this 
situation in the nearby future.

Tks.

--
waimun

On 8/19/05, Geoff Longman <[EMAIL PROTECTED]> wrote:
> No need to mess with renderComponent as there is a handy prebuilt
> component for such tasks...
> 
> PageLink A will render if someExpression evaluates to true (or any non
> null value).
> 
> <li>
>   <span jwcid="@Conditional" condition="ognl:someExpression">
>    <PageLink A>
> </span>
> <PageLink B></li>
> 
> Geoff
> 
> On 8/19/05, Waimun Yeow <[EMAIL PROTECTED]> wrote:
> > Thank you so much!
> >
> > I have another question related to super.renderComponent. It's actually not 
> > a problem in my application right now, but I am anticipating that the 
> > following scenario might occur some time later:
> >
> > Let's suppose:
> >
> > 1) there are two PageLink components defined in the component spec
> >
> > 2) in the component template, we have <li><PageLink A><PageLink B></li>
> >
> > Therefore, a call to super.renderComponent will render all these tags. If I 
> > wanted to add a logic that selectively render <PageLink A> and also the 
> > enclosing <li> tag, I would getComponent for <PageLink A> and invoke 
> > render(). But what about the <li> or the other static stuff (if exists) in 
> > the component template?
> >
> > What would be a correct way of doing this?
> >
> > Thanks again.
> >
> > --
> > waimun
> >
> > On 8/19/05, Geoff Longman <[EMAIL PROTECTED]> wrote:
> > > override renderComponent, do your checks, then call super.renderComponent
> > >
> > > Geoff
> > >
> > > On 8/18/05, Waimun Yeow <[EMAIL PROTECTED]> wrote:
> > > > Hi,
> > > >
> > > > I am subclassing BaseComponent, and in the class renderComponent()
> > > > method, I would like to render the contents of the component's template
> > > > after some logic checks are performed and determined that the component
> > > > should render.
> > > >
> > > > How do I do that? I tried to use render() method but I get
> > > > stackoverflow exception.
> > > >
> > > > Please advise.
> > > >
> > > > Thanks.
> > > >
> > > > --
> > > > waimun
> > > >


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

Reply via email to