[ https://issues.apache.org/jira/browse/MYFACES-4176?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16296956#comment-16296956 ]
Thomas Andraschko edited comment on MYFACES-4176 at 12/19/17 3:26 PM: ---------------------------------------------------------------------- I don't think we have to review the algorithm. We just must decide if we use the option IGNORE_NO_RESULT in the outputLabelRenderer or not. Both Mojarra and MyFaces did a fallback in the past when no result was found. So i think it's ok to pass IGNORE_NO_RESULT. was (Author: tandraschko): I don't think we have to review the algorithm. I just must decide if we use the option IGNORE_NO_RESULT in the outputLabelRenderer or not. Both Mojarra and MyFaces did a fallback in the past when no result was found. So i think it's ok to pass IGNORE_NO_RESULT. > Search expression fails to resolve component outside of form > ------------------------------------------------------------ > > Key: MYFACES-4176 > URL: https://issues.apache.org/jira/browse/MYFACES-4176 > Project: MyFaces Core > Issue Type: Bug > Affects Versions: 2.3.0-beta > Reporter: Jay Sartoris > Assignee: Thomas Andraschko > Priority: Minor > Fix For: 2.3.0 > > Attachments: JSF23AjaxTest.war > > > There seems to be a bug in the > org.apache.myfaces.component.search.SearchExpressionHandlerImpl class when a > client id is specified in the render attribute that is outside of the form > that the f:ajax component resides. > For example: > {noformat} > <h:body> > <h:form id="form1"> > <h:commandButton id="testButton1" value="GetResult" > action="#{testBean.test()}"> > <f:ajax listener="#{testBean.ajaxListener}" render="testOutput1"/> > </h:commandButton> > </h:form> > <br/> > <h:outputText id="testOutput1" value="#{testBean.result}"/> > </h:body> > {noformat} > You can see that the commandButton and ajax components are within the form > but the render attribute specified is outside of it. > When the Ajax code is generated for the button, you can see that render > section is pointing to the commandButton id instead of the specified > 'testOutput1' id that is actually specified in the f:ajax render attribute. > {panel:title=JSF 2.3} > onclick="jsf.util.chain(this, > event,'jsf.ajax.request(this,event,{*render:\'form1:testButton1 > \'*,\'javax.faces.behavior.event\':\'action\'})'); return false;" > {panel} > When this same scenario is tested on JSF 2.2, the render section is > correct...pointing to the testOutput1 id. > {panel:title=JSF 2.2} > onclick="jsf.util.chain(document.getElementById('form1:testButton1'), > event,'jsf.ajax.request(\'form1:testButton1\',event,{*render:\'testOutput1 > \'*,\'javax.faces.behavior.event\':\'action\'})'); return false;" > {panel} > This scenario also works on Mojarra JSF 2.3. > I debugged the issue and it seems > org.apache.myfaces.component.search.SearchExpressionHandlerImpl.invokeOnComponent > method, the "expression" variable has the correct value that we want to > render ("testOutput1") but it is unable to find this component because it > only searches within the form. My thought is that the code should try to > iterate through the parent.getParent to try to find the id it's looking for. > The code looks as though it's doing that (around line 163). However, in this > scenario the code path never drops in to that block of code. What ends up > happening is the client id of the commandButton is returned. Therefore, the > testOutput1 component is not updated when the button is clicked. > I've attached a testcase to easily reproduce the scenario. This could > potentially be a high impact issue since partial request aren't updating > components outside of their immediate parent. -- This message was sent by Atlassian JIRA (v6.4.14#64029)