JSF Parameter Bassing
Hi,
Given the following scenario;
Page A (SearchPage) can navigate to two possible pages Page B (ViewPage) and Page C (EditPage).
I wish to pass information such as a persons details from the SearchPage to the View or Edit Pages. As I understand this can be done either of two ways;
1. As request parameters on the HTTP request object. This isn't really an option as the information would be two verbose and would be best served in a pojo/bean.
2. Use a backing bean and access the backing bean from the view/edit pages. This will work, but I must know the name of the bean (that was used in the SearchPage) in the view/edit pages. Since I want the view/edit pages to be extended for different types of object (e.g. Person, Address, Car) I don't really want to know where the request is coming from. Is there some way of 'injecting' the appropriate BackingBean as a parameter to the view/edit pages.
Thanks,
Brian
[966 byte] By [
bdillona] at [2007-11-27 8:58:56]

# 1
> Hi,
>
> Given the following scenario;
>
> Page A (SearchPage) can navigate to two possible
> pages Page B (ViewPage) and Page C (EditPage).
>
> I wish to pass information such as a persons details
> from the SearchPage to the View or Edit Pages. As I
> understand this can be done either of two ways;
>
> 1. As request parameters on the HTTP request object.
> This isn't really an option as the information would
> be two verbose and would be best served in a
> pojo/bean.
>
> 2. Use a backing bean and access the backing bean
> from the view/edit pages. This will work, but I must
> know the name of the bean (that was used in the
> SearchPage) in the view/edit pages. Since I want the
> view/edit pages to be extended for different types of
> object (e.g. Person, Address, Car) I don't really
> want to know where the request is coming from. Is
> there some way of 'injecting' the appropriate
> BackingBean as a parameter to the view/edit pages.
>
> Thanks,
>
> Brian
if you dont want to pass it as request parameter directly put it in the session or Just have a managed bean in your session scope, you can directly use this bean in your Page B or C, create a new Java class add all members which you want to pass it to the other pages, register this class in your faces config.xml like this
<managed-bean>
<managed-bean-name>mgbean</managed-bean-name>
<managed-bean-class>com.package.MgBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
@VK@a at 2007-7-12 21:25:48 >
