On 2/13/06, Craig McClanahan <[EMAIL PROTECTED]> wrote:
> On 2/12/06, Mark Lowe <[EMAIL PROTECTED]> wrote:
> > Okay
> >
> > I've decided to let the renderer do the work of rendering parent and
> > children. Moving on from that I'm having trouble understanding where I
> > want to add child components. Doing this in the renderer seems wrong
> > as I want to have different validators associated with components
> > depending on a which country the component is being created for..
> >
> > I want to do something like
> >
> > if("EN".equals(mycomponent.getCountry ()) {
> > //add UIInputs according to this country.
> > }
> >
> > I'm just unsure which method in UIComponent I want to do this in.
>
> This is the kind of use case where Shale's[1] "view controller" API becomes
> useful. The prerender() method is a perfect place to do this sort of thing
> -- it is called immediately before rendering, even on the initial display of
> a page.
>
> You can do the same thing yourself without Shale, but it's quite a bit more
> work -- define a PhaseListener that listens for Render Response phase, and
> set things up in the beforePhase() method. But it's a lot easier to let the
> framework call you at the right time.
I can get my head around how this would be handy were i doing the work
in the backing bean, but I don't see how this would help create a
component.
I've managed to do what i need anyhow, many thanks for the responses..
Mark
>
> > Mark
>
> Craig
>
> [1] http://struts.apache.org/struts-shale/
>
>