You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Curtiss Howard <cu...@gmail.com> on 2010/05/06 14:29:12 UTC

Assistance requested with MYFACES-2704

Hi,

Our tester has found an issue that apparently is not tested in CTS but
nonetheless is a bug with MyFaces (confirmed that it does not occur
with Glassfish).

Let's say we have the following:

<h:commandButton ...>
  <f:param name="paramName" value="value1" />
</h:commandButton>
<h:commandButton ...>
  <f:param name="paramName" value="value2" />
</h:commandButton>

We'll render two buttons and two hidden inputs with the name
"paramName" but two different values.  The problem is that one value
will clobber the other and you don't get the value you expect when
clicking the second button.  Obviously the fix is to make the logic in
HtmlButtonRendererBase behave like the link case, where onclick
Javascript is rendered to dynamically set the correct parameter value
depending on which button was clicked.  I've spent some time trying to
do this by reusing the oamSubmit() code, but it doesn't seem to work
(looks like the target makes it open another browser window and in our
case, we do navigation based on the param, and that navigation never
occurs).  Unfortunately due to other obligations I'm not sure that I
have the time to really fix this "correctly" right away.  I think
there are a couple of cases that have to be handled... rendering this
JS when there's no onclick, when there is an onclick, when behaviors
are attached, etc.  It's a bit too much for me to get into at the
moment and I'm not that familiar with this portion of the code.  Is
there anyone out there willing to lend a hand?

Thanks in advance,


Curtiss Howard

Re: Assistance requested with MYFACES-2704

Posted by Leonardo Uribe <lu...@gmail.com>.
Hi Curtiss

I have a solution for this one. Really, we have to do something similar to
the code we have on h:commandLink. I'm not attached the patch yet, because I
need to commit "MYFACES-2687 Make sure jsf.js is included if client
behaviors are rendered" first, but before that I sent an email to dev list
to make people aware of the implications of commit that code.

regards,

Leonardo Uribe

2010/5/10 Curtiss Howard <cu...@gmail.com>

> Hi Leonardo,
>
> We tried this init-param, and it does render function calls in the
> onclick, but it never actually renders the functions themselves.  Is
> there something I'm missing here...?
>
> Thanks,
>
>
> Curtiss Howard
>
> On Thu, May 6, 2010 at 3:14 PM, Leonardo Uribe <lu...@gmail.com> wrote:
> > Hi
> >
> > 2010/5/6 Curtiss Howard <cu...@gmail.com>
> >>
> >> Thanks for the update Leonardo.  But just to be clear, when we try
> >> this scenario on Glassfish they're doing essentially what I proposed
> >> (separate onclick JS that sets the right value).  Does that param need
> >> to be default then...?
> >>
> >
> > I think we should change the algorithm a little. If
> HtmlButtonRendererBase
> > needs to render some hidden field like in this case, force render the
> clear
> > hidden field javascript, but I'm not sure because we need to keep
> > compatibility
> > with Mojarra. The web config param was created to deal with other
> > context, so before do anything it is necessary to check the history of
> this
> > issue.
> >
> > regards,
> >
> > Leonardo Uribe
> >
> >>
> >> Curtiss Howard
> >>
> >>
> >>
> >> On Thu, May 6, 2010 at 9:32 AM, Leonardo Uribe <lu...@gmail.com>
> wrote:
> >> > Hi
> >> >
> >> > There is a change introduced on MYFACES-2372. The renderkit javadoc
> says
> >> > this:
> >> >
> >> > ".....If the component being rendered by this renderer has any
> >> > UIParameter
> >> > children, each one of them must be rendered using the renderer for
> >> > component-family: "javax.faces.Input" and renderer-type:
> >> > "javax.faces.Hidden". For discussion, this is called the
> hiddenRenderer.
> >> > A
> >> > component with component-type "javax.faces.Input" must be created for
> >> > local
> >> > use in rendering each UIParameter child. The "id" property of the
> >> > temporary
> >> > component must be set to the "name" of the UIParameter. The "value"
> >> > property
> >> > of the temporary component must be set to the "value" of the
> >> > UIParameter.
> >> > For each UIParameter  child, the hiddenRenderer must have its
> >> > encodeBegin(),
> >> > encodeChildren(), and encodeEnd() methods called, in order, passing
> the
> >> > temporary component as the second argument....."
> >> >
> >> > So, we put the code at the end of HtmlButtonRendererBase.encodeEnd().
> In
> >> > theory if you set the web config para
> >> > org.apache.myfaces.RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON to true, the
> >> > required
> >> > javascript that clear hidden fields will be set and the problem you
> >> > mention
> >> > dissapear.
> >> >
> >> > I'll check this one (it is necessary to track this one from 1.2), but
> it
> >> > will take some time, right now I'm busy implementing
> >> > composite:clientBehavior tag.
> >> >
> >> > regards,
> >> >
> >> > Leonardo Uribe
> >> >
> >> > 2010/5/6 Curtiss Howard <cu...@gmail.com>
> >> >>
> >> >> Hi,
> >> >>
> >> >> Our tester has found an issue that apparently is not tested in CTS
> but
> >> >> nonetheless is a bug with MyFaces (confirmed that it does not occur
> >> >> with Glassfish).
> >> >>
> >> >> Let's say we have the following:
> >> >>
> >> >> <h:commandButton ...>
> >> >>  <f:param name="paramName" value="value1" />
> >> >> </h:commandButton>
> >> >> <h:commandButton ...>
> >> >>  <f:param name="paramName" value="value2" />
> >> >> </h:commandButton>
> >> >>
> >> >> We'll render two buttons and two hidden inputs with the name
> >> >> "paramName" but two different values.  The problem is that one value
> >> >> will clobber the other and you don't get the value you expect when
> >> >> clicking the second button.  Obviously the fix is to make the logic
> in
> >> >> HtmlButtonRendererBase behave like the link case, where onclick
> >> >> Javascript is rendered to dynamically set the correct parameter value
> >> >> depending on which button was clicked.  I've spent some time trying
> to
> >> >> do this by reusing the oamSubmit() code, but it doesn't seem to work
> >> >> (looks like the target makes it open another browser window and in
> our
> >> >> case, we do navigation based on the param, and that navigation never
> >> >> occurs).  Unfortunately due to other obligations I'm not sure that I
> >> >> have the time to really fix this "correctly" right away.  I think
> >> >> there are a couple of cases that have to be handled... rendering this
> >> >> JS when there's no onclick, when there is an onclick, when behaviors
> >> >> are attached, etc.  It's a bit too much for me to get into at the
> >> >> moment and I'm not that familiar with this portion of the code.  Is
> >> >> there anyone out there willing to lend a hand?
> >> >>
> >> >> Thanks in advance,
> >> >>
> >> >>
> >> >> Curtiss Howard
> >> >
> >> >
> >
> >
>

Re: Assistance requested with MYFACES-2704

Posted by Curtiss Howard <cu...@gmail.com>.
Hi Leonardo,

We tried this init-param, and it does render function calls in the
onclick, but it never actually renders the functions themselves.  Is
there something I'm missing here...?

Thanks,


Curtiss Howard

On Thu, May 6, 2010 at 3:14 PM, Leonardo Uribe <lu...@gmail.com> wrote:
> Hi
>
> 2010/5/6 Curtiss Howard <cu...@gmail.com>
>>
>> Thanks for the update Leonardo.  But just to be clear, when we try
>> this scenario on Glassfish they're doing essentially what I proposed
>> (separate onclick JS that sets the right value).  Does that param need
>> to be default then...?
>>
>
> I think we should change the algorithm a little. If HtmlButtonRendererBase
> needs to render some hidden field like in this case, force render the clear
> hidden field javascript, but I'm not sure because we need to keep
> compatibility
> with Mojarra. The web config param was created to deal with other
> context, so before do anything it is necessary to check the history of this
> issue.
>
> regards,
>
> Leonardo Uribe
>
>>
>> Curtiss Howard
>>
>>
>>
>> On Thu, May 6, 2010 at 9:32 AM, Leonardo Uribe <lu...@gmail.com> wrote:
>> > Hi
>> >
>> > There is a change introduced on MYFACES-2372. The renderkit javadoc says
>> > this:
>> >
>> > ".....If the component being rendered by this renderer has any
>> > UIParameter
>> > children, each one of them must be rendered using the renderer for
>> > component-family: "javax.faces.Input" and renderer-type:
>> > "javax.faces.Hidden". For discussion, this is called the hiddenRenderer.
>> > A
>> > component with component-type "javax.faces.Input" must be created for
>> > local
>> > use in rendering each UIParameter child. The "id" property of the
>> > temporary
>> > component must be set to the "name" of the UIParameter. The "value"
>> > property
>> > of the temporary component must be set to the "value" of the
>> > UIParameter.
>> > For each UIParameter  child, the hiddenRenderer must have its
>> > encodeBegin(),
>> > encodeChildren(), and encodeEnd() methods called, in order, passing the
>> > temporary component as the second argument....."
>> >
>> > So, we put the code at the end of HtmlButtonRendererBase.encodeEnd(). In
>> > theory if you set the web config para
>> > org.apache.myfaces.RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON to true, the
>> > required
>> > javascript that clear hidden fields will be set and the problem you
>> > mention
>> > dissapear.
>> >
>> > I'll check this one (it is necessary to track this one from 1.2), but it
>> > will take some time, right now I'm busy implementing
>> > composite:clientBehavior tag.
>> >
>> > regards,
>> >
>> > Leonardo Uribe
>> >
>> > 2010/5/6 Curtiss Howard <cu...@gmail.com>
>> >>
>> >> Hi,
>> >>
>> >> Our tester has found an issue that apparently is not tested in CTS but
>> >> nonetheless is a bug with MyFaces (confirmed that it does not occur
>> >> with Glassfish).
>> >>
>> >> Let's say we have the following:
>> >>
>> >> <h:commandButton ...>
>> >>  <f:param name="paramName" value="value1" />
>> >> </h:commandButton>
>> >> <h:commandButton ...>
>> >>  <f:param name="paramName" value="value2" />
>> >> </h:commandButton>
>> >>
>> >> We'll render two buttons and two hidden inputs with the name
>> >> "paramName" but two different values.  The problem is that one value
>> >> will clobber the other and you don't get the value you expect when
>> >> clicking the second button.  Obviously the fix is to make the logic in
>> >> HtmlButtonRendererBase behave like the link case, where onclick
>> >> Javascript is rendered to dynamically set the correct parameter value
>> >> depending on which button was clicked.  I've spent some time trying to
>> >> do this by reusing the oamSubmit() code, but it doesn't seem to work
>> >> (looks like the target makes it open another browser window and in our
>> >> case, we do navigation based on the param, and that navigation never
>> >> occurs).  Unfortunately due to other obligations I'm not sure that I
>> >> have the time to really fix this "correctly" right away.  I think
>> >> there are a couple of cases that have to be handled... rendering this
>> >> JS when there's no onclick, when there is an onclick, when behaviors
>> >> are attached, etc.  It's a bit too much for me to get into at the
>> >> moment and I'm not that familiar with this portion of the code.  Is
>> >> there anyone out there willing to lend a hand?
>> >>
>> >> Thanks in advance,
>> >>
>> >>
>> >> Curtiss Howard
>> >
>> >
>
>

Re: Assistance requested with MYFACES-2704

Posted by Leonardo Uribe <lu...@gmail.com>.
Hi

2010/5/6 Curtiss Howard <cu...@gmail.com>

> Thanks for the update Leonardo.  But just to be clear, when we try
> this scenario on Glassfish they're doing essentially what I proposed
> (separate onclick JS that sets the right value).  Does that param need
> to be default then...?
>
>
I think we should change the algorithm a little. If HtmlButtonRendererBase
needs to render some hidden field like in this case, force render the clear
hidden field javascript, but I'm not sure because we need to keep
compatibility
with Mojarra. The web config param was created to deal with other
context, so before do anything it is necessary to check the history of this
issue.

regards,

Leonardo Uribe


>
> Curtiss Howard
>
>
>
> On Thu, May 6, 2010 at 9:32 AM, Leonardo Uribe <lu...@gmail.com> wrote:
> > Hi
> >
> > There is a change introduced on MYFACES-2372. The renderkit javadoc says
> > this:
> >
> > ".....If the component being rendered by this renderer has any
> UIParameter
> > children, each one of them must be rendered using the renderer for
> > component-family: "javax.faces.Input" and renderer-type:
> > "javax.faces.Hidden". For discussion, this is called the hiddenRenderer.
> A
> > component with component-type "javax.faces.Input" must be created for
> local
> > use in rendering each UIParameter child. The "id" property of the
> temporary
> > component must be set to the "name" of the UIParameter. The "value"
> property
> > of the temporary component must be set to the "value" of the UIParameter.
> > For each UIParameter  child, the hiddenRenderer must have its
> encodeBegin(),
> > encodeChildren(), and encodeEnd() methods called, in order, passing the
> > temporary component as the second argument....."
> >
> > So, we put the code at the end of HtmlButtonRendererBase.encodeEnd(). In
> > theory if you set the web config para
> > org.apache.myfaces.RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON to true, the
> required
> > javascript that clear hidden fields will be set and the problem you
> mention
> > dissapear.
> >
> > I'll check this one (it is necessary to track this one from 1.2), but it
> > will take some time, right now I'm busy implementing
> > composite:clientBehavior tag.
> >
> > regards,
> >
> > Leonardo Uribe
> >
> > 2010/5/6 Curtiss Howard <cu...@gmail.com>
> >>
> >> Hi,
> >>
> >> Our tester has found an issue that apparently is not tested in CTS but
> >> nonetheless is a bug with MyFaces (confirmed that it does not occur
> >> with Glassfish).
> >>
> >> Let's say we have the following:
> >>
> >> <h:commandButton ...>
> >>  <f:param name="paramName" value="value1" />
> >> </h:commandButton>
> >> <h:commandButton ...>
> >>  <f:param name="paramName" value="value2" />
> >> </h:commandButton>
> >>
> >> We'll render two buttons and two hidden inputs with the name
> >> "paramName" but two different values.  The problem is that one value
> >> will clobber the other and you don't get the value you expect when
> >> clicking the second button.  Obviously the fix is to make the logic in
> >> HtmlButtonRendererBase behave like the link case, where onclick
> >> Javascript is rendered to dynamically set the correct parameter value
> >> depending on which button was clicked.  I've spent some time trying to
> >> do this by reusing the oamSubmit() code, but it doesn't seem to work
> >> (looks like the target makes it open another browser window and in our
> >> case, we do navigation based on the param, and that navigation never
> >> occurs).  Unfortunately due to other obligations I'm not sure that I
> >> have the time to really fix this "correctly" right away.  I think
> >> there are a couple of cases that have to be handled... rendering this
> >> JS when there's no onclick, when there is an onclick, when behaviors
> >> are attached, etc.  It's a bit too much for me to get into at the
> >> moment and I'm not that familiar with this portion of the code.  Is
> >> there anyone out there willing to lend a hand?
> >>
> >> Thanks in advance,
> >>
> >>
> >> Curtiss Howard
> >
> >
>

Re: Assistance requested with MYFACES-2704

Posted by Curtiss Howard <cu...@gmail.com>.
Thanks for the update Leonardo.  But just to be clear, when we try
this scenario on Glassfish they're doing essentially what I proposed
(separate onclick JS that sets the right value).  Does that param need
to be default then...?


Curtiss Howard



On Thu, May 6, 2010 at 9:32 AM, Leonardo Uribe <lu...@gmail.com> wrote:
> Hi
>
> There is a change introduced on MYFACES-2372. The renderkit javadoc says
> this:
>
> ".....If the component being rendered by this renderer has any UIParameter
> children, each one of them must be rendered using the renderer for
> component-family: "javax.faces.Input" and renderer-type:
> "javax.faces.Hidden". For discussion, this is called the hiddenRenderer. A
> component with component-type "javax.faces.Input" must be created for local
> use in rendering each UIParameter child. The "id" property of the temporary
> component must be set to the "name" of the UIParameter. The "value" property
> of the temporary component must be set to the "value" of the UIParameter.
> For each UIParameter  child, the hiddenRenderer must have its encodeBegin(),
> encodeChildren(), and encodeEnd() methods called, in order, passing the
> temporary component as the second argument....."
>
> So, we put the code at the end of HtmlButtonRendererBase.encodeEnd(). In
> theory if you set the web config para
> org.apache.myfaces.RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON to true, the required
> javascript that clear hidden fields will be set and the problem you mention
> dissapear.
>
> I'll check this one (it is necessary to track this one from 1.2), but it
> will take some time, right now I'm busy implementing
> composite:clientBehavior tag.
>
> regards,
>
> Leonardo Uribe
>
> 2010/5/6 Curtiss Howard <cu...@gmail.com>
>>
>> Hi,
>>
>> Our tester has found an issue that apparently is not tested in CTS but
>> nonetheless is a bug with MyFaces (confirmed that it does not occur
>> with Glassfish).
>>
>> Let's say we have the following:
>>
>> <h:commandButton ...>
>>  <f:param name="paramName" value="value1" />
>> </h:commandButton>
>> <h:commandButton ...>
>>  <f:param name="paramName" value="value2" />
>> </h:commandButton>
>>
>> We'll render two buttons and two hidden inputs with the name
>> "paramName" but two different values.  The problem is that one value
>> will clobber the other and you don't get the value you expect when
>> clicking the second button.  Obviously the fix is to make the logic in
>> HtmlButtonRendererBase behave like the link case, where onclick
>> Javascript is rendered to dynamically set the correct parameter value
>> depending on which button was clicked.  I've spent some time trying to
>> do this by reusing the oamSubmit() code, but it doesn't seem to work
>> (looks like the target makes it open another browser window and in our
>> case, we do navigation based on the param, and that navigation never
>> occurs).  Unfortunately due to other obligations I'm not sure that I
>> have the time to really fix this "correctly" right away.  I think
>> there are a couple of cases that have to be handled... rendering this
>> JS when there's no onclick, when there is an onclick, when behaviors
>> are attached, etc.  It's a bit too much for me to get into at the
>> moment and I'm not that familiar with this portion of the code.  Is
>> there anyone out there willing to lend a hand?
>>
>> Thanks in advance,
>>
>>
>> Curtiss Howard
>
>

Re: Assistance requested with MYFACES-2704

Posted by Leonardo Uribe <lu...@gmail.com>.
Hi

There is a change introduced on MYFACES-2372. The renderkit javadoc says
this:

".....If the component being rendered by this renderer has any UIParameter
children, each one of them must be rendered using the renderer for
component-family: "javax.faces.Input" and renderer-type:
"javax.faces.Hidden". For discussion, this is called the hiddenRenderer. A
component with component-type "javax.faces.Input" must be created for local
use in rendering each UIParameter child. The "id" property of the temporary
component must be set to the "name" of the UIParameter. The "value" property
of the temporary component must be set to the "value" of the UIParameter.
For each UIParameter  child, the hiddenRenderer must have its encodeBegin(),
encodeChildren(), and encodeEnd() methods called, in order, passing the
temporary component as the second argument....."

So, we put the code at the end of HtmlButtonRendererBase.encodeEnd(). In
theory if you set the web config para
org.apache.myfaces.RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON to true, the required
javascript that clear hidden fields will be set and the problem you mention
dissapear.

I'll check this one (it is necessary to track this one from 1.2), but it
will take some time, right now I'm busy implementing
composite:clientBehavior tag.

regards,

Leonardo Uribe

2010/5/6 Curtiss Howard <cu...@gmail.com>

> Hi,
>
> Our tester has found an issue that apparently is not tested in CTS but
> nonetheless is a bug with MyFaces (confirmed that it does not occur
> with Glassfish).
>
> Let's say we have the following:
>
> <h:commandButton ...>
>  <f:param name="paramName" value="value1" />
> </h:commandButton>
> <h:commandButton ...>
>  <f:param name="paramName" value="value2" />
> </h:commandButton>
>
> We'll render two buttons and two hidden inputs with the name
> "paramName" but two different values.  The problem is that one value
> will clobber the other and you don't get the value you expect when
> clicking the second button.  Obviously the fix is to make the logic in
> HtmlButtonRendererBase behave like the link case, where onclick
> Javascript is rendered to dynamically set the correct parameter value
> depending on which button was clicked.  I've spent some time trying to
> do this by reusing the oamSubmit() code, but it doesn't seem to work
> (looks like the target makes it open another browser window and in our
> case, we do navigation based on the param, and that navigation never
> occurs).  Unfortunately due to other obligations I'm not sure that I
> have the time to really fix this "correctly" right away.  I think
> there are a couple of cases that have to be handled... rendering this
> JS when there's no onclick, when there is an onclick, when behaviors
> are attached, etc.  It's a bit too much for me to get into at the
> moment and I'm not that familiar with this portion of the code.  Is
> there anyone out there willing to lend a hand?
>
> Thanks in advance,
>
>
> Curtiss Howard
>