users@javaserverfaces.java.net

RE: Re: How do I control a component in a single f:subview from different managed beans?

From: Todd Patrick <Todd.Patrick_at_dtn.com>
Date: Thu, 31 May 2007 10:51:10 -0500

Roger:

Thank you. That worked great.

--Todd

 

-----Original Message-----
From: Roger.Kitain_at_Sun.COM [mailto:Roger.Kitain_at_Sun.COM]
Sent: Thursday, May 31, 2007 9:57 AM
To: users_at_javaserverfaces.dev.java.net
Subject: Re: How do I control a component in a single f:subview from
different managed beans?

 From a managed bean you should be able to access a component in the
view
by:

1. making sure you specify an "id" with the component in the page:
     <h:panelGroup id="group".....

2. using the api in the managed bean - something like:

    FacesContext context = FacesContext.getCurrentInstance();
    UIViewRoot viewRoot = context.getViewRoot();
    UIPanel panel = (UIPanel)viewRoot.findComponent("group");

Onde you have the component instance, you can set your rendered
attribute.

Todd Patrick wrote:

>I have a single jsp that is referenced by three different jsp pages by
>a single f:subview. Within the f:subview there is a single
h:panelGroup.
>
> JSPSubview
> |
>----------------------
>| | |
>JSP1 JSP2 JSP3
>| | |
>MB1 MB2 MB3
>
>
>Each of the three JSPs have a managed bean with a request scope.
>
>>From each of the three managed beans, I want to control the
>h:panelGroup (again, located in the f:subview) attribute "rendered".
>
>Therefore if I send a response to JSP1, MB1 sets the h:panelGroup
>rendered attribute to true. If I send a response to JSP2, MB2 sets the
>h:panelGroup rendered attribute to false.
>
>In a nutshell, how do I reference the h:panelGroup in the f:subview
>from each of the three managed beans in code?
>
>Thanks,
>
>--Todd
>-----------------------------------------
>NOTICE: This email message is for the sole use of the intended
>recipient(s) and may contain confidential and privileged information.
>Any unauthorized use, disclosure or distribution is prohibited. If you
>are not the intended recipient, please contact the sender by reply
>email and destroy all copies of the original message.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe_at_javaserverfaces.dev.java.net
>For additional commands, e-mail:
>users-help_at_javaserverfaces.dev.java.net
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_javaserverfaces.dev.java.net
For additional commands, e-mail: users-help_at_javaserverfaces.dev.java.net