You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by daniel ccss <da...@gmail.com> on 2011/03/09 23:32:00 UTC

Hi, i have this code:

                                <*a4j:region*>

<*h:selectBooleanCheckbox*value="#{subtipo.seleccionado}"  id="checks"
                                        disabled="#{VDBean.modoEdicion ==
false}" onchange="call some javascript code" >

                                        <*a4j:support* event="onchange"
status="statustablaSubtipoVisita"

actionListener="#{VDBean.select}"
                                                     reRender="checks,
tablaActividadesVisita" >
                                                    * <a4j:actionparam
assignTo="#{VDBean.foo}" value="true" id="foo" />*


                                        </a4j:support>
                                    </h:selectBooleanCheckbox>
                                </a4j:region>

In the VDBean I have a String foo variable with the get and set methods but
when access the foo variable in the VDBean (scope: session) select method it
has the initial value "false". Why the actionParam do not set the foo
variable value??

Can anyone help me?

Thanks

Re: Posted by daniel ccss <da...@gmail.com>.
Thanks mike, I already have it: <%@ taglib uri="http://java.sun.com/jsf/core"
prefix="f"%> in fact I use other tags with the f: prefix, but
f:setPropertyActionListener do not appears.

On Thu, Mar 10, 2011 at 11:22 AM, Mike Kienenberger <mk...@gmail.com>wrote:

> You need to put something similar to
>
>    xmlns:f="http://java.sun.com/jsf/core"
>
> at the top of your template file.
>
> I don't remember the exact syntax for that under jsp -- I use facelets
> for everything.
>
> However, I would think you would get the same error for f:param and
> f:attribute.
>
> On Thu, Mar 10, 2011 at 12:17 PM, daniel ccss <da...@gmail.com>
> wrote:
> > Yes but I don´t know if is the JSF version I'm using or something else
> > because I get a compilation error that says:
> >
> > "Error(461): f:setPropertyActionListener no es una etiqueta registrada en
> > ese espacio de nombres."
> >
> > In english: "Error(461): f:setPropertyActionListener is not a registered
> tag
> > in that namespace"
> >
> > Thanks
> >
> > I also try:
> >
> >
> > 1-
> > JSP:
> >             <h:commandButton value="seleccionar"
> > actionListener="#{VDBean.seleccionar}" id="seleccionarLink">
> >                 <f:param     name="foo" value="true"/>
> >             </h:commandButton>
> > BB:
> >
> >          Map<String,String> params =
> > context.getExternalContext().getRequestParameterMap();
> >          String action = params.get("foo");
> >          System.out.println("test1: " +foo);----> Null
> > 2-
> > JSP:
> >        <h:commandButton value="seleccionar"
> > actionListener="#{VDBean.seleccionar}" id="seleccionarLink">
> >             <f:attribute name="foo" value="true" />
> >        </h:commandButton>
> > BB:
> >          action =
> > (String)actionEvent.getComponent().getAttributes().get("foo");
> >         System.out.println("test2: " + foo);----> Null
> >
> > 3-
> > JSP:
> >        <h:commandButton value="seleccionar"
> > actionListener="#{VDBean.seleccionar}" id="seleccionarLink">
> >              <a4j:actionparam assignTo="#{VDBean.foo}" value="true"
> id="foo"
> > />
> >       </h:commandButton>
> > BB:
> >         System.out.println("test3: " + this.foo);----> false (the initial
> > value)
> >
> >
> >
> > Please help! I only need to pass a parameter when a button is clicked to
> the
> > backingbean, but something so simple in teory is not working!
> >
> >
> >
> > On Thu, Mar 10, 2011 at 9:27 AM, Mike Kienenberger <mk...@gmail.com>
> > wrote:
> >>
> >> I doubt it matters whether you are using tomahawk or richfaces or
> >> something else.
> >>
> >> Have you tried <f:setPropertyActionListener target="#{VDBean.foo}"
> >> value="true" /> yet?
> >>
> >> On Thu, Mar 10, 2011 at 8:05 AM, daniel ccss <da...@gmail.com>
> >> wrote:
> >> > Anyone?
> >> >
> >> >
> >> > On Wed, Mar 9, 2011 at 5:06 PM, daniel ccss <da...@gmail.com>
> >> > wrote:
> >> >>
> >> >> Thanks Myke but I'm using myfaces tomahawk, not richfaces.
> >> >>
> >> >> I also tried a more simple code:
> >> >>
> >> >> In the JSP:
> >> >>
> >> >>                         <h:commandButton value="seleccionar"
> >> >> actionListener="#{VisitaDomiciliarBean.seleccionar}"
> >> >> id="seleccionarLink"
> >> >> style="display:none">
> >> >>                             <f:param name="booleanActividad"
> >> >> value="true"/>
> >> >>                         </h:commandButton>
> >> >>
> >> >> In the BackingBean:
> >> >>
> >> >>         FacesContext context = FacesContext.getCurrentInstance();
> >> >>         String paramVaule =
> >> >>
> >> >>
> >> >>
> (String)context.getExternalContext().getRequestParameterMap().get("booleanActividad");
> >> >>
> >> >>         System.out.println(paramVaule);-----> null
> >> >>
> >> >>
> >> >>
> >> >> But it returns null, what I'm missing?
> >> >
> >> >
> >
> >
>

Re: Posted by Mike Kienenberger <mk...@gmail.com>.
You need to put something similar to

    xmlns:f="http://java.sun.com/jsf/core"

at the top of your template file.

I don't remember the exact syntax for that under jsp -- I use facelets
for everything.

However, I would think you would get the same error for f:param and f:attribute.

On Thu, Mar 10, 2011 at 12:17 PM, daniel ccss <da...@gmail.com> wrote:
> Yes but I don´t know if is the JSF version I'm using or something else
> because I get a compilation error that says:
>
> "Error(461): f:setPropertyActionListener no es una etiqueta registrada en
> ese espacio de nombres."
>
> In english: "Error(461): f:setPropertyActionListener is not a registered tag
> in that namespace"
>
> Thanks
>
> I also try:
>
>
> 1-
> JSP:
>             <h:commandButton value="seleccionar"
> actionListener="#{VDBean.seleccionar}" id="seleccionarLink">
>                 <f:param     name="foo" value="true"/>
>             </h:commandButton>
> BB:
>
>          Map<String,String> params =
> context.getExternalContext().getRequestParameterMap();
>          String action = params.get("foo");
>          System.out.println("test1: " +foo);----> Null
> 2-
> JSP:
>        <h:commandButton value="seleccionar"
> actionListener="#{VDBean.seleccionar}" id="seleccionarLink">
>             <f:attribute name="foo" value="true" />
>        </h:commandButton>
> BB:
>          action =
> (String)actionEvent.getComponent().getAttributes().get("foo");
>         System.out.println("test2: " + foo);----> Null
>
> 3-
> JSP:
>        <h:commandButton value="seleccionar"
> actionListener="#{VDBean.seleccionar}" id="seleccionarLink">
>              <a4j:actionparam assignTo="#{VDBean.foo}" value="true" id="foo"
> />
>       </h:commandButton>
> BB:
>         System.out.println("test3: " + this.foo);----> false (the initial
> value)
>
>
>
> Please help! I only need to pass a parameter when a button is clicked to the
> backingbean, but something so simple in teory is not working!
>
>
>
> On Thu, Mar 10, 2011 at 9:27 AM, Mike Kienenberger <mk...@gmail.com>
> wrote:
>>
>> I doubt it matters whether you are using tomahawk or richfaces or
>> something else.
>>
>> Have you tried <f:setPropertyActionListener target="#{VDBean.foo}"
>> value="true" /> yet?
>>
>> On Thu, Mar 10, 2011 at 8:05 AM, daniel ccss <da...@gmail.com>
>> wrote:
>> > Anyone?
>> >
>> >
>> > On Wed, Mar 9, 2011 at 5:06 PM, daniel ccss <da...@gmail.com>
>> > wrote:
>> >>
>> >> Thanks Myke but I'm using myfaces tomahawk, not richfaces.
>> >>
>> >> I also tried a more simple code:
>> >>
>> >> In the JSP:
>> >>
>> >>                         <h:commandButton value="seleccionar"
>> >> actionListener="#{VisitaDomiciliarBean.seleccionar}"
>> >> id="seleccionarLink"
>> >> style="display:none">
>> >>                             <f:param name="booleanActividad"
>> >> value="true"/>
>> >>                         </h:commandButton>
>> >>
>> >> In the BackingBean:
>> >>
>> >>         FacesContext context = FacesContext.getCurrentInstance();
>> >>         String paramVaule =
>> >>
>> >>
>> >> (String)context.getExternalContext().getRequestParameterMap().get("booleanActividad");
>> >>
>> >>         System.out.println(paramVaule);-----> null
>> >>
>> >>
>> >>
>> >> But it returns null, what I'm missing?
>> >
>> >
>
>

Re: Posted by daniel ccss <da...@gmail.com>.
Yes but I don´t know if is the JSF version I'm using or something else
because I get a compilation error that says:

"Error(461): f:setPropertyActionListener no es una etiqueta registrada en
ese espacio de nombres."

*In english: "Error(461): f:setPropertyActionListener is not a registered
tag in that namespace"*

Thanks

I also try:


1-
JSP:
            <h:commandButton value="seleccionar"
actionListener="#{VDBean.seleccionar}" id="seleccionarLink">
               * <f:param     name="foo" value="true"/>*
            </h:commandButton>
BB:

        * Map<String,String> params =
context.getExternalContext().getRequestParameterMap();
         String action = params.get("foo");*
         System.out.println("test1: " +foo);---->* Null*
2-
JSP:
       <h:commandButton value="seleccionar"
actionListener="#{VDBean.seleccionar}" id="seleccionarLink">
       *     <f:attribute name="foo" value="true" />   *
       </h:commandButton>
BB:
        * action =
(String)actionEvent.getComponent().getAttributes().get("foo");*
        System.out.println("test2: " + foo);----> *Null*

3-
JSP:
       <h:commandButton value="seleccionar"
actionListener="#{VDBean.seleccionar}" id="seleccionarLink">
             *<a4j:actionparam assignTo="#{VDBean.foo}" value="true"
id="foo" />
*      </h:commandButton>
BB:
        System.out.println("test3: " + this.foo);---->* false (the initial
value)*



Please help! I only need to pass a parameter when a button is clicked to the
backingbean, but something so simple in teory is not working!



On Thu, Mar 10, 2011 at 9:27 AM, Mike Kienenberger <mk...@gmail.com>wrote:

> I doubt it matters whether you are using tomahawk or richfaces or
> something else.
>
> Have you tried <f:setPropertyActionListener target="#{VDBean.foo}"
> value="true" /> yet?
>
> On Thu, Mar 10, 2011 at 8:05 AM, daniel ccss <da...@gmail.com>
> wrote:
> > Anyone?
> >
> >
> > On Wed, Mar 9, 2011 at 5:06 PM, daniel ccss <da...@gmail.com>
> wrote:
> >>
> >> Thanks Myke but I'm using myfaces tomahawk, not richfaces.
> >>
> >> I also tried a more simple code:
> >>
> >> In the JSP:
> >>
> >>                         <h:commandButton value="seleccionar"
> >> actionListener="#{VisitaDomiciliarBean.seleccionar}"
> id="seleccionarLink"
> >> style="display:none">
> >>                             <f:param name="booleanActividad"
> >> value="true"/>
> >>                         </h:commandButton>
> >>
> >> In the BackingBean:
> >>
> >>         FacesContext context = FacesContext.getCurrentInstance();
> >>         String paramVaule =
> >>
> >>
> (String)context.getExternalContext().getRequestParameterMap().get("booleanActividad");
> >>
> >>         System.out.println(paramVaule);-----> null
> >>
> >>
> >>
> >> But it returns null, what I'm missing?
> >
> >
>

Re: Posted by Mike Kienenberger <mk...@gmail.com>.
I doubt it matters whether you are using tomahawk or richfaces or
something else.

Have you tried <f:setPropertyActionListener target="#{VDBean.foo}"
value="true" /> yet?

On Thu, Mar 10, 2011 at 8:05 AM, daniel ccss <da...@gmail.com> wrote:
> Anyone?
>
>
> On Wed, Mar 9, 2011 at 5:06 PM, daniel ccss <da...@gmail.com> wrote:
>>
>> Thanks Myke but I'm using myfaces tomahawk, not richfaces.
>>
>> I also tried a more simple code:
>>
>> In the JSP:
>>
>>                         <h:commandButton value="seleccionar"
>> actionListener="#{VisitaDomiciliarBean.seleccionar}" id="seleccionarLink"
>> style="display:none">
>>                             <f:param name="booleanActividad"
>> value="true"/>
>>                         </h:commandButton>
>>
>> In the BackingBean:
>>
>>         FacesContext context = FacesContext.getCurrentInstance();
>>         String paramVaule =
>>
>> (String)context.getExternalContext().getRequestParameterMap().get("booleanActividad");
>>
>>         System.out.println(paramVaule);-----> null
>>
>>
>>
>> But it returns null, what I'm missing?
>
>

Re: Posted by daniel ccss <da...@gmail.com>.
Anyone?


On Wed, Mar 9, 2011 at 5:06 PM, daniel ccss <da...@gmail.com> wrote:

> Thanks Myke but I'm using myfaces tomahawk, not richfaces.
>
> I also tried a more simple code:
>
> In the JSP:
>
>                         <h:commandButton value="seleccionar"
> actionListener="#{VisitaDomiciliarBean.seleccionar}" id="seleccionarLink"
> style="display:none">
>                             *<f:param name="booleanActividad" value="**
> true"/>*
>                         </h:commandButton>
>
> In the BackingBean:
>
>         FacesContext context = FacesContext.getCurrentInstance();
>         String paramVaule =
>
> (String)context.getExternalContext().getRequestParameterMap().get("*
> booleanActividad*");
>
>         System.out.println(paramVaule);-----> null
>
>
>
> But it returns null, what I'm missing?
>

Re: Posted by daniel ccss <da...@gmail.com>.
Thanks Myke but I'm using myfaces tomahawk, not richfaces.

I also tried a more simple code:

In the JSP:

                        <h:commandButton value="seleccionar"
actionListener="#{VisitaDomiciliarBean.seleccionar}" id="seleccionarLink"
style="display:none">
                            *<f:param name="booleanActividad" value="**
true"/>*
                        </h:commandButton>

In the BackingBean:

        FacesContext context = FacesContext.getCurrentInstance();
        String paramVaule =

(String)context.getExternalContext().getRequestParameterMap().get("*
booleanActividad*");

        System.out.println(paramVaule);-----> null



But it returns null, what I'm missing?

Re: Posted by Mike Kienenberger <mk...@gmail.com>.
I have not used a4j:actionparam, but under richfaces, I have successfully used

<a4j:support>
     <f:setPropertyActionListener target="#{target1}" value="#{value1}" />
     <f:setPropertyActionListener target="#{target2}" value="#{value2}" />
</a4j:support>

Perhaps that will do what you need.

On Wed, Mar 9, 2011 at 5:32 PM, daniel ccss <da...@gmail.com> wrote:
> Hi, i have this code:
>
>                                <*a4j:region*>
>
> <*h:selectBooleanCheckbox*value="#{subtipo.seleccionado}"  id="checks"
>                                        disabled="#{VDBean.modoEdicion ==
> false}" onchange="call some javascript code" >
>
>                                        <*a4j:support* event="onchange"
> status="statustablaSubtipoVisita"
>
> actionListener="#{VDBean.select}"
>                                                     reRender="checks,
> tablaActividadesVisita" >
>                                                    * <a4j:actionparam
> assignTo="#{VDBean.foo}" value="true" id="foo" />*
>
>
>                                        </a4j:support>
>                                    </h:selectBooleanCheckbox>
>                                </a4j:region>
>
> In the VDBean I have a String foo variable with the get and set methods but
> when access the foo variable in the VDBean (scope: session) select method it
> has the initial value "false". Why the actionParam do not set the foo
> variable value??
>
> Can anyone help me?
>
> Thanks
>