You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Srikanth Madarapu <sr...@senior-systems.com> on 2004/12/21 16:52:39 UTC

bean getter and setter with parameters.

Hi

   I have a managed bean with a getter that requires a parameter ( I have a situation where I need to pass a parameter to this getter ). What happens when submitting the form, will the property setter be called with the same parameter to the corresponding setter.

For example:

the managed bean has the following methods.

public boolean isYYY() {
   return true;
}

public void setYYY(boolean b) {
}


if I am using the isYYY method in the jsp the corresponding setYYY method with the boolean parameter will be invoked when the form is submitted.


What happens in the following case ?

public boolean isXXXX( String param) {
   return true;
}

public void setXXXX( String param, boolean b ) {
}

will the method setXXXX( param, b ) be called ?  Is there any way to achieve this behavior ??

Thanks

Antwort: Re: bean getter and setter with parameters.

Posted by ch...@globus.ch.
Use a updateActionListener. Set your parameter value in the value field 
and your attribute(parameter holder) in the property field....

<x:updateActionListener property="#{WVSSearchForm.a_SelectedWVSNbr}" 
value="#{wvs.a_WvsNbr}" />

Chris





Heath Borders <he...@gmail.com>
21.12.2004 17:00
Bitte antworten an "MyFaces Discussion"
 
        An:     MyFaces Discussion <my...@incubator.apache.org>
        Kopie: 
        Thema:  Re: bean getter and setter with parameters.


There is no way to achieve this behavior with ValueBindings, which all
components need.

On Tue, 21 Dec 2004 10:52:39 -0500, Srikanth Madarapu
<sr...@senior-systems.com> wrote:
> Hi
>
>   I have a managed bean with a getter that requires a parameter ( I have 
a situation where I need to pass a parameter to this getter ). What 
happens when submitting the form, will the property setter be called with 
the same parameter to the corresponding setter.
>
> For example:
>
> the managed bean has the following methods.
>
> public boolean isYYY() {
>   return true;
> }
>
> public void setYYY(boolean b) {
> }
>
> if I am using the isYYY method in the jsp the corresponding setYYY 
method with the boolean parameter will be invoked when the form is 
submitted.
>
> What happens in the following case ?
>
> public boolean isXXXX( String param) {
>   return true;
> }
>
> public void setXXXX( String param, boolean b ) {
> }
>
> will the method setXXXX( param, b ) be called ?  Is there any way to 
achieve this behavior ??
>
> Thanks
>


--
-Heath Borders-Wing
hborders@mail.win.org

Re: bean getter and setter with parameters.

Posted by Heath Borders <he...@gmail.com>.
There is no way to achieve this behavior with ValueBindings, which all
components need.

On Tue, 21 Dec 2004 10:52:39 -0500, Srikanth Madarapu
<sr...@senior-systems.com> wrote:
> Hi
> 
>   I have a managed bean with a getter that requires a parameter ( I have a situation where I need to pass a parameter to this getter ). What happens when submitting the form, will the property setter be called with the same parameter to the corresponding setter.
> 
> For example:
> 
> the managed bean has the following methods.
> 
> public boolean isYYY() {
>   return true;
> }
> 
> public void setYYY(boolean b) {
> }
> 
> if I am using the isYYY method in the jsp the corresponding setYYY method with the boolean parameter will be invoked when the form is submitted.
> 
> What happens in the following case ?
> 
> public boolean isXXXX( String param) {
>   return true;
> }
> 
> public void setXXXX( String param, boolean b ) {
> }
> 
> will the method setXXXX( param, b ) be called ?  Is there any way to achieve this behavior ??
> 
> Thanks
> 


-- 
-Heath Borders-Wing
hborders@mail.win.org