Craig,

Great, it now works nicely and is portable to any other view I might create
in the future without altering my GenericTable view.

On a different note:
Is it correct btw that MyFaces will use DOJO AJAX toolkit as its script
engine of choice? As we are currently looking at our options it seems to me
this will be the wisest choice right?

I have to say the more I learn about shale/MyFaces the more excited I get.
We come from a custom build mvc which we respectfully will lay to rest now
:-)

Thanks,
Joost

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Craig
McClanahan
Sent: Monday, January 15, 2007 12:24 PM
To: user@shale.apache.org
Subject: Re: How to pass object between backing beans

On 1/13/07, JS Portal Support <[EMAIL PROTECTED]> wrote:
>
> Thanks Craig,
>
> That makes sense. But the problem here is that generictable will be called
> from many views, and not just the myfiles view. So I would love the
> injection to be handled from the myfiles view, backing bean or
> managed-bean
> declaration. Is this possible?


In this case, doing an injection from the view wouldn't work anyway, right?

Fortunately, since it's your controller that knows what view it is going to
navigate to, it can do the injection programmatically.  There's two
different possible techniques:

Using standard JSF APIs, programmatically evaluate an EL expression like
this:

    FacesContext context = FacesContext.getCurrentInstance();
    ValueBinding vb = context.getApplication().createValueBinding("#{
generictable.fileList}");
    vb.setValue(context, ... the list to be injected ...);

or, if you are extending AbstractViewController, you can take advantage of a
helper method:

    GenericTable gt = getBean("generictable");
    gt.setFileList(... the list to be injected ...);

So basically I want my s:view to pass instantiated objects to its
> s:subview's


For this particular scenario, putting the injection code into the prerender
method of the outer view should do the trick.  That's the same place you
would go grab data that you might need for the outer view itself, so it's
nicely consistent when using subviews.

Thanks,
> Joost


Craig

Reply via email to