You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Gregg Bolinger <gd...@gmail.com> on 2006/06/06 19:04:41 UTC

Passing Object to Page

Currently, I know how to pass an object by value binding it to the session.

FacesContext context = FacesContext.getCurrentInstance();
Application application = context.getApplication();
application.createValueBinding("#{sessionScope.someObject}").setValue(context,
someObject);

I then access this property from my bean via the managed-property facility
in the faces-config.

A few of my pages act as both an Add and Modify page.  Using the above
technique, when I come to the page as Modify, everything is fine, but when I
come back as Add, I still have the object in the session and so it displays
old data.

Is there a way to pass an object to a page that is just in the request scope
similar to the above solution?

Thanks.

Re: Passing Object to Page

Posted by Gregg Bolinger <gd...@gmail.com>.
Yes, I have tried that and it worked.  That is what I am currently going
with for now.

Thanks.

On 6/7/06, Cosma Colanicchia <co...@gmail.com> wrote:
>
> Can't you simply put it into requestScope instead of sessionScope?
> (You should then avoid <redirect/>s)
>
> Cosma
>
>
> 2006/6/6, Gregg Bolinger <gd...@gmail.com>:
> > Currently, I know how to pass an object by value binding it to the
> session.
> >
> > FacesContext context = FacesContext.getCurrentInstance();
> > Application application = context.getApplication();
> > application.createValueBinding
> > ("#{sessionScope.someObject}").setValue(context, someObject);
> >
> > I then access this property from my bean via the managed-property
> facility
> > in the faces-config.
> >
> > A few of my pages act as both an Add and Modify page.  Using the above
> > technique, when I come to the page as Modify, everything is fine, but
> when I
> > come back as Add, I still have the object in the session and so it
> displays
> > old data.
> >
> > Is there a way to pass an object to a page that is just in the request
> scope
> > similar to the above solution?
> >
> > Thanks.
> >
>

Re: Passing Object to Page

Posted by Cosma Colanicchia <co...@gmail.com>.
Can't you simply put it into requestScope instead of sessionScope?
(You should then avoid <redirect/>s)

Cosma


2006/6/6, Gregg Bolinger <gd...@gmail.com>:
> Currently, I know how to pass an object by value binding it to the session.
>
> FacesContext context = FacesContext.getCurrentInstance();
> Application application = context.getApplication();
> application.createValueBinding
> ("#{sessionScope.someObject}").setValue(context, someObject);
>
> I then access this property from my bean via the managed-property facility
> in the faces-config.
>
> A few of my pages act as both an Add and Modify page.  Using the above
> technique, when I come to the page as Modify, everything is fine, but when I
> come back as Add, I still have the object in the session and so it displays
> old data.
>
> Is there a way to pass an object to a page that is just in the request scope
> similar to the above solution?
>
> Thanks.
>