myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthias Wessendorf" <mat...@apache.org>
Subject Re: Getting reference to caller UIComponent from managed bean setter/getter
Date Mon, 29 May 2006 20:03:49 GMT
... to fast.

also you can use binding attribute and *wire* the component itself to
your backing bean

-Matthias

On 5/29/06, Matthias Wessendorf <matzew@apache.org> wrote:
> You can call setStyle() on HtmlCommandLink clazz
>
> See [1]
>
> [1] http://tinyurl.com/kjgo7
>
> On 5/29/06, Furer Alexander <alex_s4@bezeqint.net> wrote:
> >
> >
> > Sven,
> > I have implemented your advise beforehand.. now i want to set style for A
> > elements according to selected locale, that's why i use
> > styleClass="#{locale.style}"
> >
> >
> > ----- Original Message -----
> >
> > From: Sven Haiges
> > To: MyFaces Discussion
> > Sent: Monday, May 29, 2006 8:58 PM
> > Subject: Re: Getting reference to caller UIComponent from managed bean
> > setter/getter
> >
> > I think the easiest option is to use an actionListener instead the action
> > attribute. You then have a myActionlistener(ActionEvent e) Method in your
> > backing bean and can call a method to retrieve the component that was
> > clicked on. with that you can get the name of the id and change the locale
> > accordingly.
> >
> > I even give the id ("de", "en", etc.) directly to a new Locale(id) and
> > assign that local to the UIViewRoot to change the language used.
> >
> > Hope that helps,
> >
> > Sven
> >
> >
> > On 5/29/06, Furer Alexander <alex_s4@bezeqint.net> wrote:
> > >
> > >
> > >
> > > Hi
> > > Is there any way to get reference to caller UIComponent from managed bean
> > getter/setter function ?
> > > For example , assume we have following jsp fragment:
> > >
> > >
> > >
> > > <h:commandLink id="en"  styleClass="#{locale.style}">
> > >
> > > <h:outputText value="English" />
> > >
> > > </h:commandLink>
> > >
> > > <h:commandLink id="he" styleClass ="#{locale.style}">
> > >
> > > <h:outputText value="Hebrew" />
> > >
> > > </h:commandLink>
> > >
> > >
> > >
> > > class Locale{
> > >
> > > String     getStyle(){
> > >
> > >     HERE I WANT TO GET reference to  UIComponent ( in one case - its
> > command link with id=="en" , second case - with id=="he")
> > >
> > > }
> > >
> > > }
> > >
> > > Any ideas ?
> > >
> > > Thanks
> >
> >
> >
> > --
> > Sven Haiges
> > sven.haiges@googlemail.com
> >
> > TEL +49 89 420 958 993 | SIPgate 8008878 | Skype: hansamann
> > Personal Homepage, Wiki & Blog: http://www.svenhaiges.de
> >
>
>
> --
> Matthias Wessendorf
> Aechterhoek 18
> 48282 Emsdetten
> http://jroller.com/page/mwessendorf
> mwessendorf-at-gmail-dot-com
>


-- 
Matthias Wessendorf
Aechterhoek 18
48282 Emsdetten
http://jroller.com/page/mwessendorf
mwessendorf-at-gmail-dot-com

Mime
View raw message