You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Yee CN <ye...@streamyx.com> on 2005/10/27 11:12:00 UTC

How to pass parameters between pages..

Hi,

 

I have been wondering how to pass parameters between pages.

 

In the jsp days I would encode it in the http request parameters. But with
JSF page navigation I guess I have to do it via the backing beans. 

 

Lets say the navigation is from A to B. A would need to call a method in B's
backing bean to give it the parameter. That is fine conceptually - however
the problem with this approach is then B's backing bean would need to be in
the session scope, which may not always be appropriate.

 

Or maybe we should consider using ThreadLocal for parameter passing? This
approach is appealing has we don't have to do any cleaning up afterwards. Or
maybe a lightweight Backing bean specifically for the purpose of parameters
passing?

 

Is there a best practice for this yet?

 

Many thanks in advance.

 

Yee

 

 


Re: How to pass parameters between pages..

Posted by Mike Kienenberger <mk...@gmail.com>.
If you post a specific example of what you're trying to do, I might be
able to provide more details.

On 10/27/05, Yee CN <ye...@streamyx.com> wrote:
> Hi Mike,
>
> I can see how to use t:saveState to pass fields value from one page to the
> next. However I can't see how to initiate a series of action based on it -
> like loading up a product from the database.
>
> Regards,
> Yee
>
> -----Original Message-----
> From: Mike Kienenberger [mailto:mkienenb@gmail.com]
> Sent: Thursday, 27 October 2005 9:42 PM
> To: MyFaces Discussion; yeecn@streamyx.com
> Subject: Re: How to pass parameters between pages..
>
> There's probably a number of ways to do this.
>
> How I'm currently doing it is to use a request-scoped bean (backing
> bean B in your example) and use an identical t:saveState on both pages
> to save either the entire bean, or the field I set on the bean.
>
>
> On 10/27/05, Yee CN <ye...@streamyx.com> wrote:
> >
> >
> >
> > Hi,
> >
> >
> >
> > I have been wondering how to pass parameters between pages.
> >
> >
> >
> > In the jsp days I would encode it in the http request parameters. But with
> > JSF page navigation I guess I have to do it via the backing beans.
> >
> >
> >
> > Lets say the navigation is from A to B. A would need to call a method in
> B's
> > backing bean to give it the parameter. That is fine conceptually - however
> > the problem with this approach is then B's backing bean would need to be
> in
> > the session scope, which may not always be appropriate.
> >
> >
> >
> > Or maybe we should consider using ThreadLocal for parameter passing? This
> > approach is appealing has we don't have to do any cleaning up afterwards.
> Or
> > maybe a lightweight Backing bean specifically for the purpose of
> parameters
> > passing?
> >
> >
> >
> > Is there a best practice for this yet?
> >
> >
> >
> > Many thanks in advance.
> >
> >
> >
> > Yee
> >
> >
> >
> >
>
>

Re: How to pass parameters between pages..

Posted by Mike Kienenberger <mk...@gmail.com>.
There's probably a number of ways to do this.

How I'm currently doing it is to use a request-scoped bean (backing
bean B in your example) and use an identical t:saveState on both pages
to save either the entire bean, or the field I set on the bean.


On 10/27/05, Yee CN <ye...@streamyx.com> wrote:
>
>
>
> Hi,
>
>
>
> I have been wondering how to pass parameters between pages.
>
>
>
> In the jsp days I would encode it in the http request parameters. But with
> JSF page navigation I guess I have to do it via the backing beans.
>
>
>
> Lets say the navigation is from A to B. A would need to call a method in B's
> backing bean to give it the parameter. That is fine conceptually – however
> the problem with this approach is then B's backing bean would need to be in
> the session scope, which may not always be appropriate.
>
>
>
> Or maybe we should consider using ThreadLocal for parameter passing? This
> approach is appealing has we don't have to do any cleaning up afterwards. Or
> maybe a lightweight Backing bean specifically for the purpose of parameters
> passing?
>
>
>
> Is there a best practice for this yet?
>
>
>
> Many thanks in advance.
>
>
>
> Yee
>
>
>
>