You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Zhao Koh <zh...@gmail.com> on 2012/12/20 11:45:30 UTC
MyFaces 2.1.8 - Issues with composite component renderFacet
Hi all,
I am currently using MyFaces 2.1.8 but discovered an issue with composite component renderFacet - and this issue started at version 2.1.4.
The following describes the problem:
I have a composite component called buttonSelectBox that uses composite:renderFacet to inject content from client - nothing fancy, only a span that surrounds the content.
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:p="http://primefaces.org/ui">
<composite:interface>
<composite:attribute name="compId" required="true" />
<composite:attribute name="defaultText" required="true" />
<composite:facet name="content" required="false" />
</composite:interface>
<composite:implementation>
<span class="buttonlink">
<composite:renderFacet name="content" />
</span>
</composite:implementation>
</html>
Then I have a facelet page that uses this composite component and a standard <h:commandButton> that invokes an action.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:custom="http://java.sun.com/jsf/composite/components"
xmlns:p="http://primefaces.org/ui"
xmlns:pe="http://primefaces.org/ui/extensions"
lang="en">
<h:head>
</h:head>
<h:body>
<div class="container">
<div class="row">
<div id="workspace">
<h:form id="taskListForm" prependId="false">
<custom:buttonSelectBox compId="myLinksMenu" defaultText="2222">
<f:facet name="content">
<ul>
<li><a href="#">My Preferences</a></li>
</ul>
<ul>
<li><a href="#">My Profile</a></li>
<li><a href="#{facesContext.externalContext.requestContextPath}/logout">Logout</a></li>
</ul>
</f:facet>
</custom:buttonSelectBox>
<h:commandButton action="#{testBean.buttonAction}" value="Click ME" />
</h:form>
</div>
</div>
</div>
</h:body>
</html>
The issue is whenever the web app that contains the above deployed to web container (I am using Websphere 7), the button on the facelet page does not register the action until the second click, i.e. the first click does nothing. The request did reach the server though.
I have tried every version since 2.1.4 - 2.1.8, and it still occurring - so I am currently downgraded to 2.1.3.
Can you please advise if this is a bug or something that I have missed? If this is a bug, how can I go about raising this in JIRA?
Any comment would be much appreciated.
Thanks.
Regards,
Zhao
Re: MyFaces 2.1.8 - Issues with composite component renderFacet
Posted by Leonardo Uribe <lu...@gmail.com>.
Hi
2012/12/21 Zhao Koh <zh...@gmail.com>:
> Thanks Leonardo for the prompt response.
>
> I did a test today by removing prependId="false" from my form, but it does not seem to fix the issue with v2.1.8.
>
Strange. If that so, it could be caused by something different. I'm
sure the implementation of cc:renderFacet is correct, so maybe it is
something related to your application.
> One question - how can I re-open the JIRA ticket MYFACES-3373? I have registered myself in JIRA but unable to re-open the issue which is closed at the moment.
>
I cloned the issue:
https://issues.apache.org/jira/browse/MYFACES-3668
> Leonardo, if you have any interim workaround for this issue, please let me know.
>
For now, the only thing I can do is fix the problem detected with prependId.
The latests builds can be found here:
https://repository.apache.org/content/repositories/snapshots/org/apache/myfaces/core/
Note I can't reproduce the issue using tomcat or jetty. If you can
create a war file demostrating the problem and attach it to the issue
maybe there is chance to find what's wrong and fix it, otherwise
nothing will happen, because such behavior hasn't been reported by
somebody else.
regards,
Leonardo Uribe
> Thanks again.
>
> Regards,
> Zhao
>
>
> On 21/12/2012, at 4:32 AM, Leonardo Uribe wrote:
>
>> Hi
>>
>> It is probably a bug, just that it is hard to see it at first view. I
>> can't reproduce it,
>> but I found the change that create the problem:
>>
>> https://issues.apache.org/jira/browse/MYFACES-3373
>>
>> UIForm.createUniqueId should take into account prependId logic
>>
>> The problem is related to
>>
>> https://issues.apache.org/jira/browse/MYFACES-3663
>>
>> UIViewRoot.createUniqueId() should generate unique ids for all the
>> component tree.
>>
>> I think in your case there should be one component programatically added by a
>> third party library that changes the order of the generated ids. If
>> the order changes,
>> the action is not executed the first time. I suppose if you set
>> prependId to true it
>> will work.
>>
>> Please reopen MYFACES-3373 in order to fix it properly. I think the
>> solution is only
>> apply the code when prependId is false AND the seed is not provided.
>>
>> Thanks for the report. Issues like this one are hard to find.
>>
>> regards,
>>
>> Leonardo Uribe
>>
>> 2012/12/20 Zhao Koh <zh...@gmail.com>:
>>> Hi all,
>>>
>>> I am currently using MyFaces 2.1.8 but discovered an issue with composite
>>> component renderFacet - and this issue started at version 2.1.4.
>>>
>>> The following describes the problem:
>>>
>>> I have a composite component called buttonSelectBox that uses
>>> composite:renderFacet to inject content from client - nothing fancy, only a
>>> span that surrounds the content.
>>>
>>>
>>> <html xmlns="http://www.w3.org/1999/xhtml"
>>> xmlns:h="http://java.sun.com/jsf/html"
>>> xmlns:f="http://java.sun.com/jsf/core"
>>> xmlns:c="http://java.sun.com/jsp/jstl/core"
>>> xmlns:ui="http://java.sun.com/jsf/facelets"
>>> xmlns:composite="http://java.sun.com/jsf/composite"
>>> xmlns:p="http://primefaces.org/ui">
>>>
>>> <composite:interface>
>>> <composite:attribute name="compId" required="true" />
>>> <composite:attribute name="defaultText" required="true" />
>>> <composite:facet name="content" required="false" />
>>> </composite:interface>
>>>
>>> <composite:implementation>
>>> <span class="buttonlink">
>>> <composite:renderFacet name="content" />
>>> </span>
>>> </composite:implementation>
>>>
>>> </html>
>>>
>>>
>>>
>>> Then I have a facelet page that uses this composite component and a standard
>>> <h:commandButton> that invokes an action.
>>>
>>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>>>
>>> <html xmlns="http://www.w3.org/1999/xhtml"
>>> xmlns:h="http://java.sun.com/jsf/html"
>>> xmlns:c="http://java.sun.com/jsp/jstl/core"
>>> xmlns:f="http://java.sun.com/jsf/core"
>>> xmlns:ui="http://java.sun.com/jsf/facelets"
>>> xmlns:custom="http://java.sun.com/jsf/composite/components"
>>> xmlns:p="http://primefaces.org/ui"
>>> xmlns:pe="http://primefaces.org/ui/extensions"
>>> lang="en">
>>>
>>> <h:head>
>>> </h:head>
>>> <h:body>
>>>
>>> <div class="container">
>>>
>>> <div class="row">
>>> <div id="workspace">
>>> <h:form id="taskListForm" prependId="false">
>>> <custom:buttonSelectBox
>>> compId="myLinksMenu" defaultText="2222">
>>> <f:facet name="content">
>>> <ul>
>>> <li><a href="#">My
>>> Preferences</a></li>
>>> </ul>
>>> <ul>
>>> <li><a href="#">My
>>> Profile</a></li>
>>> <li><a
>>> href="#{facesContext.externalContext.requestContextPath}/logout">Logout</a></li>
>>> </ul>
>>> </f:facet>
>>> </custom:buttonSelectBox>
>>>
>>> <h:commandButton
>>> action="#{testBean.buttonAction}" value="Click ME" />
>>> </h:form>
>>> </div>
>>> </div>
>>> </div>
>>>
>>> </h:body>
>>> </html>
>>>
>>>
>>> The issue is whenever the web app that contains the above deployed to web
>>> container (I am using Websphere 7), the button on the facelet page does not
>>> register the action until the second click, i.e. the first click does
>>> nothing. The request did reach the server though.
>>>
>>> I have tried every version since 2.1.4 - 2.1.8, and it still occurring - so
>>> I am currently downgraded to 2.1.3.
>>>
>>> Can you please advise if this is a bug or something that I have missed? If
>>> this is a bug, how can I go about raising this in JIRA?
>>>
>>> Any comment would be much appreciated.
>>>
>>> Thanks.
>>>
>>> Regards,
>>> Zhao
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>
Re: MyFaces 2.1.8 - Issues with composite component renderFacet
Posted by Zhao Koh <zh...@gmail.com>.
Thanks Leonardo for the prompt response.
I did a test today by removing prependId="false" from my form, but it does not seem to fix the issue with v2.1.8.
One question - how can I re-open the JIRA ticket MYFACES-3373? I have registered myself in JIRA but unable to re-open the issue which is closed at the moment.
Leonardo, if you have any interim workaround for this issue, please let me know.
Thanks again.
Regards,
Zhao
On 21/12/2012, at 4:32 AM, Leonardo Uribe wrote:
> Hi
>
> It is probably a bug, just that it is hard to see it at first view. I
> can't reproduce it,
> but I found the change that create the problem:
>
> https://issues.apache.org/jira/browse/MYFACES-3373
>
> UIForm.createUniqueId should take into account prependId logic
>
> The problem is related to
>
> https://issues.apache.org/jira/browse/MYFACES-3663
>
> UIViewRoot.createUniqueId() should generate unique ids for all the
> component tree.
>
> I think in your case there should be one component programatically added by a
> third party library that changes the order of the generated ids. If
> the order changes,
> the action is not executed the first time. I suppose if you set
> prependId to true it
> will work.
>
> Please reopen MYFACES-3373 in order to fix it properly. I think the
> solution is only
> apply the code when prependId is false AND the seed is not provided.
>
> Thanks for the report. Issues like this one are hard to find.
>
> regards,
>
> Leonardo Uribe
>
> 2012/12/20 Zhao Koh <zh...@gmail.com>:
>> Hi all,
>>
>> I am currently using MyFaces 2.1.8 but discovered an issue with composite
>> component renderFacet - and this issue started at version 2.1.4.
>>
>> The following describes the problem:
>>
>> I have a composite component called buttonSelectBox that uses
>> composite:renderFacet to inject content from client - nothing fancy, only a
>> span that surrounds the content.
>>
>>
>> <html xmlns="http://www.w3.org/1999/xhtml"
>> xmlns:h="http://java.sun.com/jsf/html"
>> xmlns:f="http://java.sun.com/jsf/core"
>> xmlns:c="http://java.sun.com/jsp/jstl/core"
>> xmlns:ui="http://java.sun.com/jsf/facelets"
>> xmlns:composite="http://java.sun.com/jsf/composite"
>> xmlns:p="http://primefaces.org/ui">
>>
>> <composite:interface>
>> <composite:attribute name="compId" required="true" />
>> <composite:attribute name="defaultText" required="true" />
>> <composite:facet name="content" required="false" />
>> </composite:interface>
>>
>> <composite:implementation>
>> <span class="buttonlink">
>> <composite:renderFacet name="content" />
>> </span>
>> </composite:implementation>
>>
>> </html>
>>
>>
>>
>> Then I have a facelet page that uses this composite component and a standard
>> <h:commandButton> that invokes an action.
>>
>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>>
>> <html xmlns="http://www.w3.org/1999/xhtml"
>> xmlns:h="http://java.sun.com/jsf/html"
>> xmlns:c="http://java.sun.com/jsp/jstl/core"
>> xmlns:f="http://java.sun.com/jsf/core"
>> xmlns:ui="http://java.sun.com/jsf/facelets"
>> xmlns:custom="http://java.sun.com/jsf/composite/components"
>> xmlns:p="http://primefaces.org/ui"
>> xmlns:pe="http://primefaces.org/ui/extensions"
>> lang="en">
>>
>> <h:head>
>> </h:head>
>> <h:body>
>>
>> <div class="container">
>>
>> <div class="row">
>> <div id="workspace">
>> <h:form id="taskListForm" prependId="false">
>> <custom:buttonSelectBox
>> compId="myLinksMenu" defaultText="2222">
>> <f:facet name="content">
>> <ul>
>> <li><a href="#">My
>> Preferences</a></li>
>> </ul>
>> <ul>
>> <li><a href="#">My
>> Profile</a></li>
>> <li><a
>> href="#{facesContext.externalContext.requestContextPath}/logout">Logout</a></li>
>> </ul>
>> </f:facet>
>> </custom:buttonSelectBox>
>>
>> <h:commandButton
>> action="#{testBean.buttonAction}" value="Click ME" />
>> </h:form>
>> </div>
>> </div>
>> </div>
>>
>> </h:body>
>> </html>
>>
>>
>> The issue is whenever the web app that contains the above deployed to web
>> container (I am using Websphere 7), the button on the facelet page does not
>> register the action until the second click, i.e. the first click does
>> nothing. The request did reach the server though.
>>
>> I have tried every version since 2.1.4 - 2.1.8, and it still occurring - so
>> I am currently downgraded to 2.1.3.
>>
>> Can you please advise if this is a bug or something that I have missed? If
>> this is a bug, how can I go about raising this in JIRA?
>>
>> Any comment would be much appreciated.
>>
>> Thanks.
>>
>> Regards,
>> Zhao
>>
>>
>>
>>
>>
>>
>>
Re: MyFaces 2.1.8 - Issues with composite component renderFacet
Posted by Leonardo Uribe <lu...@gmail.com>.
Hi
It is probably a bug, just that it is hard to see it at first view. I
can't reproduce it,
but I found the change that create the problem:
https://issues.apache.org/jira/browse/MYFACES-3373
UIForm.createUniqueId should take into account prependId logic
The problem is related to
https://issues.apache.org/jira/browse/MYFACES-3663
UIViewRoot.createUniqueId() should generate unique ids for all the
component tree.
I think in your case there should be one component programatically added by a
third party library that changes the order of the generated ids. If
the order changes,
the action is not executed the first time. I suppose if you set
prependId to true it
will work.
Please reopen MYFACES-3373 in order to fix it properly. I think the
solution is only
apply the code when prependId is false AND the seed is not provided.
Thanks for the report. Issues like this one are hard to find.
regards,
Leonardo Uribe
2012/12/20 Zhao Koh <zh...@gmail.com>:
> Hi all,
>
> I am currently using MyFaces 2.1.8 but discovered an issue with composite
> component renderFacet - and this issue started at version 2.1.4.
>
> The following describes the problem:
>
> I have a composite component called buttonSelectBox that uses
> composite:renderFacet to inject content from client - nothing fancy, only a
> span that surrounds the content.
>
>
> <html xmlns="http://www.w3.org/1999/xhtml"
> xmlns:h="http://java.sun.com/jsf/html"
> xmlns:f="http://java.sun.com/jsf/core"
> xmlns:c="http://java.sun.com/jsp/jstl/core"
> xmlns:ui="http://java.sun.com/jsf/facelets"
> xmlns:composite="http://java.sun.com/jsf/composite"
> xmlns:p="http://primefaces.org/ui">
>
> <composite:interface>
> <composite:attribute name="compId" required="true" />
> <composite:attribute name="defaultText" required="true" />
> <composite:facet name="content" required="false" />
> </composite:interface>
>
> <composite:implementation>
> <span class="buttonlink">
> <composite:renderFacet name="content" />
> </span>
> </composite:implementation>
>
> </html>
>
>
>
> Then I have a facelet page that uses this composite component and a standard
> <h:commandButton> that invokes an action.
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>
> <html xmlns="http://www.w3.org/1999/xhtml"
> xmlns:h="http://java.sun.com/jsf/html"
> xmlns:c="http://java.sun.com/jsp/jstl/core"
> xmlns:f="http://java.sun.com/jsf/core"
> xmlns:ui="http://java.sun.com/jsf/facelets"
> xmlns:custom="http://java.sun.com/jsf/composite/components"
> xmlns:p="http://primefaces.org/ui"
> xmlns:pe="http://primefaces.org/ui/extensions"
> lang="en">
>
> <h:head>
> </h:head>
> <h:body>
>
> <div class="container">
>
> <div class="row">
> <div id="workspace">
> <h:form id="taskListForm" prependId="false">
> <custom:buttonSelectBox
> compId="myLinksMenu" defaultText="2222">
> <f:facet name="content">
> <ul>
> <li><a href="#">My
> Preferences</a></li>
> </ul>
> <ul>
> <li><a href="#">My
> Profile</a></li>
> <li><a
> href="#{facesContext.externalContext.requestContextPath}/logout">Logout</a></li>
> </ul>
> </f:facet>
> </custom:buttonSelectBox>
>
> <h:commandButton
> action="#{testBean.buttonAction}" value="Click ME" />
> </h:form>
> </div>
> </div>
> </div>
>
> </h:body>
> </html>
>
>
> The issue is whenever the web app that contains the above deployed to web
> container (I am using Websphere 7), the button on the facelet page does not
> register the action until the second click, i.e. the first click does
> nothing. The request did reach the server though.
>
> I have tried every version since 2.1.4 - 2.1.8, and it still occurring - so
> I am currently downgraded to 2.1.3.
>
> Can you please advise if this is a bug or something that I have missed? If
> this is a bug, how can I go about raising this in JIRA?
>
> Any comment would be much appreciated.
>
> Thanks.
>
> Regards,
> Zhao
>
>
>
>
>
>
>