You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Yee CN <ye...@streamyx.com> on 2005/10/31 11:01:10 UTC

Bugs with commandLink rendered="..."

Hi,

 

I think there are is a bug in commandLink in treating the "rendered"
attributes.

 

Below is a demonstration. The jsf page concerned is to have an 'edit' more
and a 'browse' mode. When the page is in edit mode the 'Save Changes' and
'Cancel' button will show, else the 'Edit' and 'Back' button will show.

 

The rendering of the buttons are OK, however as it stands the 'Save Changes'
and 'Cancel' button will not trigger the backing bean action. If I take away
the rendered="." attributes I will see all 4 buttons, but everything works
as expected.

 

-------------------------------------------------------------------------

                        

<h:commandLink value="Edit"  action="#{userBean.editUserAction}"
rendered="#{!userBean.isEdit}">

</h:commandLink>

<f:verbatim>&nbsp&nbsp</f:verbatim> 

<h:commandLink value="Back" action="#{userBean.backAction}"
rendered="#{!userBean.isEdit}">

</h:commandLink>

<h:commandLink value="Save Changes" action="#{userBean.saveAction}"
rendered="#{userBean.isEdit}">

</h:commandLink>

<f:verbatim>&nbsp&nbsp</f:verbatim> 

<h:commandLink value="Cancel" action="#{userBean.backAction}"
rendered="#{userBean.isEdit}">

</h:commandLink>

 

 

Is there a work around for this?

 

Thanks

 

Yee


Re: Bugs with commandLink rendered="..."

Posted by Martin Marinschek <ma...@gmail.com>.
Yes, you are absolutely right.

We are on the right path, though, I think.

And - you would not have got support like this from Microsoft, right?

Plus - if you want to change how things are working, you can. So by
any means, help us to close the gap!

regards,

Martin

On 10/31/05, Yee CN <ye...@streamyx.com> wrote:
> Martin,
>
> That solved my problems. Thanks very much for you explanation.
>
> I think JSF still need a bit of work. Coming from ASP.NET background I think
> .NET Web Form framework is quite a bit easier to master. I hope JSF or Shale
> will bridge the gap soon.
>
> Regards,
> Yee
>
> -----Original Message-----
> From: Martin Marinschek [mailto:martin.marinschek@gmail.com]
> Sent: Monday, 31 October 2005 6:13 PM
> To: MyFaces Discussion; yeecn@streamyx.com
> Subject: Re: Bugs with commandLink rendered="..."
>
> Is userBean a request scoped Bean?
>
> If yes, you'll need to use a session bean instead or use t:saveState
> to save the state of the user bean between requests.
>
> The problem is that the link is rendered, you click on it, the
> lifeCycle is triggered again and now the rendered attribute of the
> link is evaluated to false as the userBean has lost its state - so the
> link is not decoded and the action is not triggered.
>
> regards,
>
> Martin
>
> On 10/31/05, Yee CN <ye...@streamyx.com> wrote:
> >
> >
> >
> > Hi,
> >
> >
> >
> > I think there are is a bug in commandLink in treating the "rendered"
> > attributes.
> >
> >
> >
> > Below is a demonstration. The jsf page concerned is to have an 'edit' more
> > and a 'browse' mode. When the page is in edit mode the 'Save Changes' and
> > 'Cancel' button will show, else the 'Edit' and 'Back' button will show.
> >
> >
> >
> > The rendering of the buttons are OK, however as it stands the 'Save
> Changes'
> > and 'Cancel' button will not trigger the backing bean action. If I take
> away
> > the rendered="." attributes I will see all 4 buttons, but everything works
> > as expected.
> >
> >
> >
> > -------------------------------------------------------------------------
> >
> >
> >
> > <h:commandLink value="Edit"  action="#{userBean.editUserAction}"
> > rendered="#{!userBean.isEdit}">
> >
> > </h:commandLink>
> >
> > <f:verbatim>&nbsp&nbsp</f:verbatim>
> >
> > <h:commandLink value="Back" action="#{userBean.backAction}"
> > rendered="#{!userBean.isEdit}">
> >
> > </h:commandLink>
> >
> > <h:commandLink value="Save Changes" action="#{userBean.saveAction}"
> > rendered="#{userBean.isEdit}">
> >
> > </h:commandLink>
> >
> > <f:verbatim>&nbsp&nbsp</f:verbatim>
> >
> > <h:commandLink value="Cancel" action="#{userBean.backAction}"
> > rendered="#{userBean.isEdit}">
> >
> > </h:commandLink>
> >
> >
> >
> >
> >
> >
> > Is there a work around for this?
> >
> >
> >
> > Thanks
> >
> >
> >
> > Yee
>
>
> --
>
> http://www.irian.at
> Your JSF powerhouse -
> JSF Trainings in English and German
>
>


--

http://www.irian.at
Your JSF powerhouse -
JSF Trainings in English and German

RE: Bugs with commandLink rendered="..."

Posted by Yee CN <ye...@streamyx.com>.
Martin,

That solved my problems. Thanks very much for you explanation.

I think JSF still need a bit of work. Coming from ASP.NET background I think
.NET Web Form framework is quite a bit easier to master. I hope JSF or Shale
will bridge the gap soon.

Regards,
Yee

-----Original Message-----
From: Martin Marinschek [mailto:martin.marinschek@gmail.com] 
Sent: Monday, 31 October 2005 6:13 PM
To: MyFaces Discussion; yeecn@streamyx.com
Subject: Re: Bugs with commandLink rendered="..."

Is userBean a request scoped Bean?

If yes, you'll need to use a session bean instead or use t:saveState
to save the state of the user bean between requests.

The problem is that the link is rendered, you click on it, the
lifeCycle is triggered again and now the rendered attribute of the
link is evaluated to false as the userBean has lost its state - so the
link is not decoded and the action is not triggered.

regards,

Martin

On 10/31/05, Yee CN <ye...@streamyx.com> wrote:
>
>
>
> Hi,
>
>
>
> I think there are is a bug in commandLink in treating the "rendered"
> attributes.
>
>
>
> Below is a demonstration. The jsf page concerned is to have an 'edit' more
> and a 'browse' mode. When the page is in edit mode the 'Save Changes' and
> 'Cancel' button will show, else the 'Edit' and 'Back' button will show.
>
>
>
> The rendering of the buttons are OK, however as it stands the 'Save
Changes'
> and 'Cancel' button will not trigger the backing bean action. If I take
away
> the rendered="." attributes I will see all 4 buttons, but everything works
> as expected.
>
>
>
> -------------------------------------------------------------------------
>
>
>
> <h:commandLink value="Edit"  action="#{userBean.editUserAction}"
> rendered="#{!userBean.isEdit}">
>
> </h:commandLink>
>
> <f:verbatim>&nbsp&nbsp</f:verbatim>
>
> <h:commandLink value="Back" action="#{userBean.backAction}"
> rendered="#{!userBean.isEdit}">
>
> </h:commandLink>
>
> <h:commandLink value="Save Changes" action="#{userBean.saveAction}"
> rendered="#{userBean.isEdit}">
>
> </h:commandLink>
>
> <f:verbatim>&nbsp&nbsp</f:verbatim>
>
> <h:commandLink value="Cancel" action="#{userBean.backAction}"
> rendered="#{userBean.isEdit}">
>
> </h:commandLink>
>
>
>
>
>
>
> Is there a work around for this?
>
>
>
> Thanks
>
>
>
> Yee


--

http://www.irian.at
Your JSF powerhouse -
JSF Trainings in English and German


Re: Bugs with commandLink rendered="..."

Posted by Martin Marinschek <ma...@gmail.com>.
Is userBean a request scoped Bean?

If yes, you'll need to use a session bean instead or use t:saveState
to save the state of the user bean between requests.

The problem is that the link is rendered, you click on it, the
lifeCycle is triggered again and now the rendered attribute of the
link is evaluated to false as the userBean has lost its state - so the
link is not decoded and the action is not triggered.

regards,

Martin

On 10/31/05, Yee CN <ye...@streamyx.com> wrote:
>
>
>
> Hi,
>
>
>
> I think there are is a bug in commandLink in treating the "rendered"
> attributes.
>
>
>
> Below is a demonstration. The jsf page concerned is to have an 'edit' more
> and a 'browse' mode. When the page is in edit mode the 'Save Changes' and
> 'Cancel' button will show, else the 'Edit' and 'Back' button will show.
>
>
>
> The rendering of the buttons are OK, however as it stands the 'Save Changes'
> and 'Cancel' button will not trigger the backing bean action. If I take away
> the rendered="…" attributes I will see all 4 buttons, but everything works
> as expected.
>
>
>
> -------------------------------------------------------------------------
>
>
>
> <h:commandLink value="Edit"  action="#{userBean.editUserAction}"
> rendered="#{!userBean.isEdit}">
>
> </h:commandLink>
>
> <f:verbatim>&nbsp&nbsp</f:verbatim>
>
> <h:commandLink value="Back" action="#{userBean.backAction}"
> rendered="#{!userBean.isEdit}">
>
> </h:commandLink>
>
> <h:commandLink value="Save Changes" action="#{userBean.saveAction}"
> rendered="#{userBean.isEdit}">
>
> </h:commandLink>
>
> <f:verbatim>&nbsp&nbsp</f:verbatim>
>
> <h:commandLink value="Cancel" action="#{userBean.backAction}"
> rendered="#{userBean.isEdit}">
>
> </h:commandLink>
>
>
>
>
>
>
> Is there a work around for this?
>
>
>
> Thanks
>
>
>
> Yee


--

http://www.irian.at
Your JSF powerhouse -
JSF Trainings in English and German