You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shale.apache.org by Ramineni Viswanath <vr...@yahoo.com> on 2006/11/07 18:50:46 UTC

How to find the backing bean name?

Hi,

Is there a better way to get the backing bean name 
(not the class name) other than by building it from
getFacesContext().getViewRoot().getViewId()?  I have a
BasePage class from where I extend all my backing bean
classes, there are times when I need this name,
especially in cases where I cannot use Clay and I have
to use dynamic method binding.

--Vish



 
____________________________________________________________________________________
Sponsored Link

Try Netflix today! With plans starting at only $5.99 a month what are you waiting for?
http://www.netflix.com/Signup?mqso=80010030

Re: How to find the backing bean name?

Posted by Craig McClanahan <cr...@apache.org>.
On 11/7/06, Ramineni Viswanath <vr...@yahoo.com> wrote:
>
> Hi,
>
> Is there a better way to get the backing bean name
> (not the class name) other than by building it from
> getFacesContext().getViewRoot().getViewId()?


This is going to be the only robust mechanism, because an application can
actually replace the algorithm that Shale normally uses, which is an
implementation of ViewControllerMapper stored in application scope at key
"org$apache$shale$view$VIEW_MAPPER".  Your processing should do the
following to get the name of the relevant managed bean:

* Extract the view identifier, using the formula above.

* Retrieve the ViewControllerMapper implementation
  at the attribute name above.

* Call the mapViewId() method to determine the name
  of the corresponding managed bean (if any).

Craig



  I have a
> BasePage class from where I extend all my backing bean
> classes, there are times when I need this name,
> especially in cases where I cannot use Clay and I have
> to use dynamic method binding.
>
> --Vish
>
>
>
>
>
> ____________________________________________________________________________________
> Sponsored Link
>
> Try Netflix today! With plans starting at only $5.99 a month what are you
> waiting for?
> http://www.netflix.com/Signup?mqso=80010030
>