[JBoss JIRA] (RF-13776) a4j:ajax problem with hierarchical component IDs
by Brian Leathem (JIRA)
[ https://issues.jboss.org/browse/RF-13776?page=com.atlassian.jira.plugin.s... ]
Brian Leathem commented on RF-13776:
------------------------------------
oic, it's possible that we are looking for the first _RichFaces component_ parent, rather than the first JSF component parent. [~michaelb80] can you try one of 2 things:
# replace the JSF {{<h:selectBooleanCheckbox>}} with a RichFaces component?
# Check what {{RichFaces.$(document.getElementById("form:treeNode:treeNodeSelectBox"))}} evaluates to?
> a4j:ajax problem with hierarchical component IDs
> ------------------------------------------------
>
> Key: RF-13776
> URL: https://issues.jboss.org/browse/RF-13776
> Project: RichFaces
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: component-a4j-core
> Affects Versions: 4.3.7
> Environment: RichFaces 4.3.7
> Mojarra 2.1.29
> Java 7 Update 67 (x64)
> Tomcat 7.0.52 (x64)
> Reporter: Michael B
>
> First of all: this is a bug report related to RF-12616.
> The actionListener of an a4j:ajax-enhanced component is not invoked on the server side. In a nutshell the problem is due to the request parameter "javax.faces.source" not matching the id of the component for which the AjaxBehaviorEvent is bound.
> The problem occurs when you assign hierarchical component ids in your xhtml.
> Here is a condensed snippet xhtml illustrating the problem:
> {code:title=Snippet|borderStyle=solid}
> <rich:treeNode id="treeNode">
> <h:selectBooleanCheckbox id="treeNodeSelectBox">
> <a4j:ajax event="click" execute="@this" listener="#{someManagedBean.onCheckboxClick}" />
> </h:selectBooleanCheckbox>
> </rich:treeNode>
> {code}
> As you can see, the id of the selectBooleanCheckbox begins with the id of the treeNode.
> The RichFaces JavaScript handler introduced a function to obviously evaluate the correct component id for the event (which is then passed as request parameter 'javax.faces.source' in the AJAX request).
> {code:title=RichFaces JS-Snippet|borderStyle=solid}
> richfaces.ajax = function(source, event, options) {
> var options = options || {};
>
> var sourceId = getSourceId(source, options);
> var sourceElement = getSourceElement(source);
>
> // event source re-targeting finds a RichFaces component root
> // to setup javax.faces.source correctly - RF-12616)
> if (sourceElement) {
> source = searchForComponentRootOrReturn(sourceElement);
> }
>
> ...
> /*
> * Returns RichFaces component root for given element in the list of ancestors of sourceElement.
> * Otherwise returns sourceElement if RichFaces component root can't be located.
> */
> var searchForComponentRootOrReturn = function(sourceElement) {
> if (sourceElement.id && !richfaces.$(sourceElement)) {
> var parentElement = false;
> jQuery(sourceElement).parents().each(function() {
> if (this.id && sourceElement.id.indexOf(this.id) == 0) { // otherwise parent element is definitely not JSF component
> var suffix = sourceElement.id.substring(this.id.length); // extract suffix
> if (suffix.match(/^[a-zA-Z]*$/) && richfaces.$(this)) {
> parentElement = this;
> return false;
> }
> }
> });
> if (parentElement !== false) {
> return parentElement;
> }
> }
> return sourceElement;
> };
> {code}
> The problem is within the function "searchForComponentRootOrReturn" which in this special case of id-hierarchy evaluates to the wrong element. The correct element to be returned here would be the "sourceElement" (selectBooleanCheckbox with the id "treeNodeSelectBox" in the example above), but the code evaluates to a "parentElement" (treeNode in the example above) due to its id "treeNode" being a prefix of the component which fired the event.
> It took me a whole day to figure that one out, since there is no useful output neither in a4j:log nor in server side logging in a case where the parameter "javax.faces.source" does not match the component id. In fact the AJAX request is executed just fine, only the event is never queued...
> (See Mojarra HtmlBasicRenderer => decodeBehaviors and its check method isBehaviorSource)
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)
10 years, 3 months
[JBoss JIRA] (RF-13776) a4j:ajax problem with hierarchical component IDs
by Brian Leathem (JIRA)
[ https://issues.jboss.org/browse/RF-13776?page=com.atlassian.jira.plugin.s... ]
Brian Leathem commented on RF-13776:
------------------------------------
[~michaelb80] can you confirm that if you change your parent id it works as expected? eg.: _treeNode_ -> _fooBar_?
I surprised this is the case, as the method {{jQuery.parents}} returns the parents in sequence starting with the first parent. We then iterate over the parents in that sequence looking for the first match.
> a4j:ajax problem with hierarchical component IDs
> ------------------------------------------------
>
> Key: RF-13776
> URL: https://issues.jboss.org/browse/RF-13776
> Project: RichFaces
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: component-a4j-core
> Affects Versions: 4.3.7
> Environment: RichFaces 4.3.7
> Mojarra 2.1.29
> Java 7 Update 67 (x64)
> Tomcat 7.0.52 (x64)
> Reporter: Michael B
>
> First of all: this is a bug report related to RF-12616.
> The actionListener of an a4j:ajax-enhanced component is not invoked on the server side. In a nutshell the problem is due to the request parameter "javax.faces.source" not matching the id of the component for which the AjaxBehaviorEvent is bound.
> The problem occurs when you assign hierarchical component ids in your xhtml.
> Here is a condensed snippet xhtml illustrating the problem:
> {code:title=Snippet|borderStyle=solid}
> <rich:treeNode id="treeNode">
> <h:selectBooleanCheckbox id="treeNodeSelectBox">
> <a4j:ajax event="click" execute="@this" listener="#{someManagedBean.onCheckboxClick}" />
> </h:selectBooleanCheckbox>
> </rich:treeNode>
> {code}
> As you can see, the id of the selectBooleanCheckbox begins with the id of the treeNode.
> The RichFaces JavaScript handler introduced a function to obviously evaluate the correct component id for the event (which is then passed as request parameter 'javax.faces.source' in the AJAX request).
> {code:title=RichFaces JS-Snippet|borderStyle=solid}
> richfaces.ajax = function(source, event, options) {
> var options = options || {};
>
> var sourceId = getSourceId(source, options);
> var sourceElement = getSourceElement(source);
>
> // event source re-targeting finds a RichFaces component root
> // to setup javax.faces.source correctly - RF-12616)
> if (sourceElement) {
> source = searchForComponentRootOrReturn(sourceElement);
> }
>
> ...
> /*
> * Returns RichFaces component root for given element in the list of ancestors of sourceElement.
> * Otherwise returns sourceElement if RichFaces component root can't be located.
> */
> var searchForComponentRootOrReturn = function(sourceElement) {
> if (sourceElement.id && !richfaces.$(sourceElement)) {
> var parentElement = false;
> jQuery(sourceElement).parents().each(function() {
> if (this.id && sourceElement.id.indexOf(this.id) == 0) { // otherwise parent element is definitely not JSF component
> var suffix = sourceElement.id.substring(this.id.length); // extract suffix
> if (suffix.match(/^[a-zA-Z]*$/) && richfaces.$(this)) {
> parentElement = this;
> return false;
> }
> }
> });
> if (parentElement !== false) {
> return parentElement;
> }
> }
> return sourceElement;
> };
> {code}
> The problem is within the function "searchForComponentRootOrReturn" which in this special case of id-hierarchy evaluates to the wrong element. The correct element to be returned here would be the "sourceElement" (selectBooleanCheckbox with the id "treeNodeSelectBox" in the example above), but the code evaluates to a "parentElement" (treeNode in the example above) due to its id "treeNode" being a prefix of the component which fired the event.
> It took me a whole day to figure that one out, since there is no useful output neither in a4j:log nor in server side logging in a case where the parameter "javax.faces.source" does not match the component id. In fact the AJAX request is executed just fine, only the event is never queued...
> (See Mojarra HtmlBasicRenderer => decodeBehaviors and its check method isBehaviorSource)
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)
10 years, 3 months
[JBoss JIRA] (RF-13776) a4j:ajax problem with hierarchical component IDs
by Michael B (JIRA)
[ https://issues.jboss.org/browse/RF-13776?page=com.atlassian.jira.plugin.s... ]
Michael B updated RF-13776:
---------------------------
Description:
First of all: this is a bug report related to RF-12616.
The actionListener of an a4j:ajax-enhanced component is not invoked on the server side. In a nutshell the problem is due to the request parameter "javax.faces.source" not matching the id of the component for which the AjaxBehaviorEvent is bound.
The problem occurs when you assign hierarchical component ids in your xhtml.
Here is a condensed snippet xhtml illustrating the problem:
{code:title=Snippet|borderStyle=solid}
<rich:treeNode id="treeNode">
<h:selectBooleanCheckbox id="treeNodeSelectBox">
<a4j:ajax event="click" execute="@this" listener="#{someManagedBean.onCheckboxClick}" />
</h:selectBooleanCheckbox>
</rich:treeNode>
{code}
As you can see, the id of the selectBooleanCheckbox begins with the id of the treeNode.
The RichFaces JavaScript handler introduced a function to obviously evaluate the correct component id for the event (which is then passed as request parameter 'javax.faces.source' in the AJAX request).
{code:title=RichFaces JS-Snippet|borderStyle=solid}
richfaces.ajax = function(source, event, options) {
var options = options || {};
var sourceId = getSourceId(source, options);
var sourceElement = getSourceElement(source);
// event source re-targeting finds a RichFaces component root
// to setup javax.faces.source correctly - RF-12616)
if (sourceElement) {
source = searchForComponentRootOrReturn(sourceElement);
}
...
/*
* Returns RichFaces component root for given element in the list of ancestors of sourceElement.
* Otherwise returns sourceElement if RichFaces component root can't be located.
*/
var searchForComponentRootOrReturn = function(sourceElement) {
if (sourceElement.id && !richfaces.$(sourceElement)) {
var parentElement = false;
jQuery(sourceElement).parents().each(function() {
if (this.id && sourceElement.id.indexOf(this.id) == 0) { // otherwise parent element is definitely not JSF component
var suffix = sourceElement.id.substring(this.id.length); // extract suffix
if (suffix.match(/^[a-zA-Z]*$/) && richfaces.$(this)) {
parentElement = this;
return false;
}
}
});
if (parentElement !== false) {
return parentElement;
}
}
return sourceElement;
};
{code}
The problem is within the function "searchForComponentRootOrReturn" which in this special case of id-hierarchy evaluates to the wrong element. The correct element to be returned here would be the "sourceElement" (selectBooleanCheckbox with the id "treeNodeSelectBox" in the example above), but the code evaluates to a "parentElement" (treeNode in the example above) due to its id "treeNode" being a prefix of the component which fired the event.
It took me a whole day to figure that one out, since there is no useful output neither in a4j:log nor in server side logging in a case where the parameter "javax.faces.source" does not match the component id. In fact the AJAX request is executed just fine, only the event is never queued...
(See Mojarra HtmlBasicRenderer => decodeBehaviors and its check method isBehaviorSource)
was:
First of all: this is a bug report related to RF-12616.
The actionListener of an a4j:ajax-enhanced component is not invoked on the server side. In a nutshell the problem is due to the request parameter "javax.faces.source" not matching the id of the component for which the AjaxBehaviorEvent is bound.
The problem occurs when you assign hierarchical component ids in your xhtml.
Here is a condensed snippet xhtml illustrating the problem:
{code:title=Snippet|borderStyle=solid}
<rich:treeNode id="treeNode">
<h:selectBooleanCheckbox id="treeNodeSelectBox">
<a4j:ajax event="click" execute="@this" listener="#{someManagedBean.onCheckboxClick}" />
</h:selectBooleanCheckbox>
</rich:treeNode>
{code}
As you can see, the id of the selectBooleanCheckbox begins with the id of the treeNode.
The RichFaces JavaScript handler introduced a function to obviously evaluate the correct component id for the event (which is then passed as request parameter 'javax.faces.source' in the AJAX request).
{code:title=RichFaces JS-Snippet|borderStyle=solid}
richfaces.ajax = function(source, event, options) {
var options = options || {};
var sourceId = getSourceId(source, options);
var sourceElement = getSourceElement(source);
// event source re-targeting finds a RichFaces component root
// to setup javax.faces.source correctly - RF-12616)
if (sourceElement) {
source = searchForComponentRootOrReturn(sourceElement);
}
...
/*
* Returns RichFaces component root for given element in the list of ancestors of sourceElement.
* Otherwise returns sourceElement if RichFaces component root can't be located.
*/
var searchForComponentRootOrReturn = function(sourceElement) {
if (sourceElement.id && !richfaces.$(sourceElement)) {
var parentElement = false;
jQuery(sourceElement).parents().each(function() {
if (this.id && sourceElement.id.indexOf(this.id) == 0) { // otherwise parent element is definitely not JSF component
var suffix = sourceElement.id.substring(this.id.length); // extract suffix
if (suffix.match(/^[a-zA-Z]*$/) && richfaces.$(this)) {
parentElement = this;
return false;
}
}
});
if (parentElement !== false) {
return parentElement;
}
}
return sourceElement;
};
{code}
The problem is within the function "searchForComponentRootOrReturn" which in this special case of id-hierarchy evaluates to the wrong element. The correct element to be returned here would be the "sourceElement" (selectBooleanCheckbox with the id "treeNodeSelectBox" in the example above), but the code evaluates to a "parent" (treeNode in the example above) due to its id "treeNode" being a prefix of the component which fired the event.
It took me a whole day to figure that one out, since there is no useful output neither in a4j:log nor in server side logging in a case where the parameter "javax.faces.source" does not match the component id. In fact the AJAX request is executed just fine, only the event is never queued...
(See Mojarra HtmlBasicRenderer => decodeBehaviors and its check method isBehaviorSource)
> a4j:ajax problem with hierarchical component IDs
> ------------------------------------------------
>
> Key: RF-13776
> URL: https://issues.jboss.org/browse/RF-13776
> Project: RichFaces
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: component-a4j-core
> Affects Versions: 4.3.7
> Environment: RichFaces 4.3.7
> Mojarra 2.1.29
> Java 7 Update 67 (x64)
> Tomcat 7.0.52 (x64)
> Reporter: Michael B
>
> First of all: this is a bug report related to RF-12616.
> The actionListener of an a4j:ajax-enhanced component is not invoked on the server side. In a nutshell the problem is due to the request parameter "javax.faces.source" not matching the id of the component for which the AjaxBehaviorEvent is bound.
> The problem occurs when you assign hierarchical component ids in your xhtml.
> Here is a condensed snippet xhtml illustrating the problem:
> {code:title=Snippet|borderStyle=solid}
> <rich:treeNode id="treeNode">
> <h:selectBooleanCheckbox id="treeNodeSelectBox">
> <a4j:ajax event="click" execute="@this" listener="#{someManagedBean.onCheckboxClick}" />
> </h:selectBooleanCheckbox>
> </rich:treeNode>
> {code}
> As you can see, the id of the selectBooleanCheckbox begins with the id of the treeNode.
> The RichFaces JavaScript handler introduced a function to obviously evaluate the correct component id for the event (which is then passed as request parameter 'javax.faces.source' in the AJAX request).
> {code:title=RichFaces JS-Snippet|borderStyle=solid}
> richfaces.ajax = function(source, event, options) {
> var options = options || {};
>
> var sourceId = getSourceId(source, options);
> var sourceElement = getSourceElement(source);
>
> // event source re-targeting finds a RichFaces component root
> // to setup javax.faces.source correctly - RF-12616)
> if (sourceElement) {
> source = searchForComponentRootOrReturn(sourceElement);
> }
>
> ...
> /*
> * Returns RichFaces component root for given element in the list of ancestors of sourceElement.
> * Otherwise returns sourceElement if RichFaces component root can't be located.
> */
> var searchForComponentRootOrReturn = function(sourceElement) {
> if (sourceElement.id && !richfaces.$(sourceElement)) {
> var parentElement = false;
> jQuery(sourceElement).parents().each(function() {
> if (this.id && sourceElement.id.indexOf(this.id) == 0) { // otherwise parent element is definitely not JSF component
> var suffix = sourceElement.id.substring(this.id.length); // extract suffix
> if (suffix.match(/^[a-zA-Z]*$/) && richfaces.$(this)) {
> parentElement = this;
> return false;
> }
> }
> });
> if (parentElement !== false) {
> return parentElement;
> }
> }
> return sourceElement;
> };
> {code}
> The problem is within the function "searchForComponentRootOrReturn" which in this special case of id-hierarchy evaluates to the wrong element. The correct element to be returned here would be the "sourceElement" (selectBooleanCheckbox with the id "treeNodeSelectBox" in the example above), but the code evaluates to a "parentElement" (treeNode in the example above) due to its id "treeNode" being a prefix of the component which fired the event.
> It took me a whole day to figure that one out, since there is no useful output neither in a4j:log nor in server side logging in a case where the parameter "javax.faces.source" does not match the component id. In fact the AJAX request is executed just fine, only the event is never queued...
> (See Mojarra HtmlBasicRenderer => decodeBehaviors and its check method isBehaviorSource)
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)
10 years, 3 months
[JBoss JIRA] (RF-13776) a4j:ajax problem with hierarchical component IDs
by Michael B (JIRA)
[ https://issues.jboss.org/browse/RF-13776?page=com.atlassian.jira.plugin.s... ]
Michael B updated RF-13776:
---------------------------
Description:
First of all: this is a bug report related to RF-12616.
The actionListener of an a4j:ajax-enhanced component is not invoked on the server side. In a nutshell the problem is due to the request parameter "javax.faces.source" not matching the id of the component for which the AjaxBehaviorEvent is bound.
The problem occurs when you assign hierarchical component ids in your xhtml.
Here is a condensed snippet xhtml illustrating the problem:
{code:title=Snippet|borderStyle=solid}
<rich:treeNode id="treeNode">
<h:selectBooleanCheckbox id="treeNodeSelectBox">
<a4j:ajax event="click" execute="@this" listener="#{someManagedBean.onCheckboxClick}" />
</h:selectBooleanCheckbox>
</rich:treeNode>
{code}
As you can see, the id of the selectBooleanCheckbox begins with the id of the treeNode.
The RichFaces JavaScript handler introduced a function to obviously evaluate the correct component id for the event (which is then passed as request parameter 'javax.faces.source' in the AJAX request).
{code:title=RichFaces JS-Snippet|borderStyle=solid}
richfaces.ajax = function(source, event, options) {
var options = options || {};
var sourceId = getSourceId(source, options);
var sourceElement = getSourceElement(source);
// event source re-targeting finds a RichFaces component root
// to setup javax.faces.source correctly - RF-12616)
if (sourceElement) {
source = searchForComponentRootOrReturn(sourceElement);
}
...
/*
* Returns RichFaces component root for given element in the list of ancestors of sourceElement.
* Otherwise returns sourceElement if RichFaces component root can't be located.
*/
var searchForComponentRootOrReturn = function(sourceElement) {
if (sourceElement.id && !richfaces.$(sourceElement)) {
var parentElement = false;
jQuery(sourceElement).parents().each(function() {
if (this.id && sourceElement.id.indexOf(this.id) == 0) { // otherwise parent element is definitely not JSF component
var suffix = sourceElement.id.substring(this.id.length); // extract suffix
if (suffix.match(/^[a-zA-Z]*$/) && richfaces.$(this)) {
parentElement = this;
return false;
}
}
});
if (parentElement !== false) {
return parentElement;
}
}
return sourceElement;
};
{code}
The problem is within the function "searchForComponentRootOrReturn" which in this special case of id-hierarchy evaluates to the wrong element. The correct element to be returned here would be the "sourceElement" (selectBooleanCheckbox with the id "treeNodeSelectBox" in the example above), but the code evaluates to a "parent" (treeNode in the example above) due to its id "treeNode" being a prefix of the component which fired the event.
It took me a whole day to figure that one out, since there is no useful output neither in a4j:log nor in server side logging in a case where the parameter "javax.faces.source" does not match the component id. In fact the AJAX request is executed just fine, only the event is never queued...
(See Mojarra HtmlBasicRenderer => decodeBehaviors and its check method isBehaviorSource)
was:
First of all: this is a bug report related to RF-12616.
The actionListener of an a4j:ajax-enhanced component is not invoked on the server side. In a nutshell the problem is due to the request parameter "javax.faces.source" not matching the id of the component for which the AjaxBehaviorEvent is bound.
The problem occurs when you assign hierarchical component ids in your xhtml.
Here is a condensed snippet xhtml illustrating the problem:
{code:title=Snippet|borderStyle=solid}
<rich:treeNode id="treeNode">
<h:selectBooleanCheckbox id="treeNodeSelectBox">
<a4j:ajax event="click" execute="@this" listener="#{someManagedBean.onCheckboxClick}" />
</h:selectBooleanCheckbox>
</rich:treeNode>
{code}
As you can see, the id of the selectBooleanCheckbox begins with the id of the treeNode.
The RichFaces JavaScript handler introduced a function to obviously evaluate the correct component id for the event (which is then passed as request parameter 'javax.faces.source' in the AJAX request).
{code:title=RichFaces JS-Snippet|borderStyle=solid}
richfaces.ajax = function(source, event, options) {
var options = options || {};
var sourceId = getSourceId(source, options);
var sourceElement = getSourceElement(source);
// event source re-targeting finds a RichFaces component root
// to setup javax.faces.source correctly - RF-12616)
if (sourceElement) {
source = searchForComponentRootOrReturn(sourceElement);
}
...
/*
* Returns RichFaces component root for given element in the list of ancestors of sourceElement.
* Otherwise returns sourceElement if RichFaces component root can't be located.
*/
var searchForComponentRootOrReturn = function(sourceElement) {
if (sourceElement.id && !richfaces.$(sourceElement)) {
var parentElement = false;
jQuery(sourceElement).parents().each(function() {
if (this.id && sourceElement.id.indexOf(this.id) == 0) { // otherwise parent element is definitely not JSF component
var suffix = sourceElement.id.substring(this.id.length); // extract suffix
if (suffix.match(/^[a-zA-Z]*$/) && richfaces.$(this)) {
parentElement = this;
return false;
}
}
});
if (parentElement !== false) {
return parentElement;
}
}
return sourceElement;
};
{code}
The problem is within the function "searchForComponentRootOrReturn" which in this special case of id-hierarchy evaluates to the wrong element. The correct element to be returned here would be the "sourceElement" (selectBooleanCheckbox with the id "treeNodeSelectBox" in the example above), but the code evaluates to a "parent" (treeNode in the example above) due to its id "treeNode" being a prefix of the component which fired the event.
It took me a whole day to figure that one out, since there is no useful output neither in a4j:log nor in server side logging in a case where the parameter "javax.faces.source" does not match the component id. In fact the AJAX request is executed just fine, only the event is never queued...
(See Mojarra HtmlBasicRenderer => decodeBehaviors and its check method isBehaviorSource)
> a4j:ajax problem with hierarchical component IDs
> ------------------------------------------------
>
> Key: RF-13776
> URL: https://issues.jboss.org/browse/RF-13776
> Project: RichFaces
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: component-a4j-core
> Affects Versions: 4.3.7
> Environment: RichFaces 4.3.7
> Mojarra 2.1.29
> Java 7 Update 67 (x64)
> Tomcat 7.0.52 (x64)
> Reporter: Michael B
>
> First of all: this is a bug report related to RF-12616.
> The actionListener of an a4j:ajax-enhanced component is not invoked on the server side. In a nutshell the problem is due to the request parameter "javax.faces.source" not matching the id of the component for which the AjaxBehaviorEvent is bound.
> The problem occurs when you assign hierarchical component ids in your xhtml.
> Here is a condensed snippet xhtml illustrating the problem:
> {code:title=Snippet|borderStyle=solid}
> <rich:treeNode id="treeNode">
> <h:selectBooleanCheckbox id="treeNodeSelectBox">
> <a4j:ajax event="click" execute="@this" listener="#{someManagedBean.onCheckboxClick}" />
> </h:selectBooleanCheckbox>
> </rich:treeNode>
> {code}
> As you can see, the id of the selectBooleanCheckbox begins with the id of the treeNode.
> The RichFaces JavaScript handler introduced a function to obviously evaluate the correct component id for the event (which is then passed as request parameter 'javax.faces.source' in the AJAX request).
> {code:title=RichFaces JS-Snippet|borderStyle=solid}
> richfaces.ajax = function(source, event, options) {
> var options = options || {};
>
> var sourceId = getSourceId(source, options);
> var sourceElement = getSourceElement(source);
>
> // event source re-targeting finds a RichFaces component root
> // to setup javax.faces.source correctly - RF-12616)
> if (sourceElement) {
> source = searchForComponentRootOrReturn(sourceElement);
> }
>
> ...
> /*
> * Returns RichFaces component root for given element in the list of ancestors of sourceElement.
> * Otherwise returns sourceElement if RichFaces component root can't be located.
> */
> var searchForComponentRootOrReturn = function(sourceElement) {
> if (sourceElement.id && !richfaces.$(sourceElement)) {
> var parentElement = false;
> jQuery(sourceElement).parents().each(function() {
> if (this.id && sourceElement.id.indexOf(this.id) == 0) { // otherwise parent element is definitely not JSF component
> var suffix = sourceElement.id.substring(this.id.length); // extract suffix
> if (suffix.match(/^[a-zA-Z]*$/) && richfaces.$(this)) {
> parentElement = this;
> return false;
> }
> }
> });
> if (parentElement !== false) {
> return parentElement;
> }
> }
> return sourceElement;
> };
> {code}
> The problem is within the function "searchForComponentRootOrReturn" which in this special case of id-hierarchy evaluates to the wrong element. The correct element to be returned here would be the "sourceElement" (selectBooleanCheckbox with the id "treeNodeSelectBox" in the example above), but the code evaluates to a "parent" (treeNode in the example above) due to its id "treeNode" being a prefix of the component which fired the event.
> It took me a whole day to figure that one out, since there is no useful output neither in a4j:log nor in server side logging in a case where the parameter "javax.faces.source" does not match the component id. In fact the AJAX request is executed just fine, only the event is never queued...
> (See Mojarra HtmlBasicRenderer => decodeBehaviors and its check method isBehaviorSource)
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)
10 years, 3 months
[JBoss JIRA] (RF-13776) a4j:ajax problem with hierarchical component IDs
by Michael B (JIRA)
Michael B created RF-13776:
------------------------------
Summary: a4j:ajax problem with hierarchical component IDs
Key: RF-13776
URL: https://issues.jboss.org/browse/RF-13776
Project: RichFaces
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: component-a4j-core
Affects Versions: 4.3.7
Environment: RichFaces 4.3.7
Mojarra 2.1.29
Java 7 Update 67 (x64)
Tomcat 7.0.52 (x64)
Reporter: Michael B
First of all: this is a bug report related to RF-12616.
The actionListener of an a4j:ajax-enhanced component is not invoked on the server side. In a nutshell the problem is due to the request parameter "javax.faces.source" not matching the id of the component for which the AjaxBehaviorEvent is bound.
The problem occurs when you assign hierarchical component ids in your xhtml.
Here is a condensed snippet xhtml illustrating the problem:
{code:title=Snippet|borderStyle=solid}
<rich:treeNode id="treeNode">
<h:selectBooleanCheckbox id="treeNodeSelectBox">
<a4j:ajax event="click" execute="@this" listener="#{someManagedBean.onCheckboxClick}" />
</h:selectBooleanCheckbox>
</rich:treeNode>
{code}
As you can see, the id of the selectBooleanCheckbox begins with the id of the treeNode.
The RichFaces JavaScript handler introduced a function to obviously evaluate the correct component id for the event (which is then passed as request parameter 'javax.faces.source' in the AJAX request).
{code:title=RichFaces JS-Snippet|borderStyle=solid}
richfaces.ajax = function(source, event, options) {
var options = options || {};
var sourceId = getSourceId(source, options);
var sourceElement = getSourceElement(source);
// event source re-targeting finds a RichFaces component root
// to setup javax.faces.source correctly - RF-12616)
if (sourceElement) {
source = searchForComponentRootOrReturn(sourceElement);
}
...
/*
* Returns RichFaces component root for given element in the list of ancestors of sourceElement.
* Otherwise returns sourceElement if RichFaces component root can't be located.
*/
var searchForComponentRootOrReturn = function(sourceElement) {
if (sourceElement.id && !richfaces.$(sourceElement)) {
var parentElement = false;
jQuery(sourceElement).parents().each(function() {
if (this.id && sourceElement.id.indexOf(this.id) == 0) { // otherwise parent element is definitely not JSF component
var suffix = sourceElement.id.substring(this.id.length); // extract suffix
if (suffix.match(/^[a-zA-Z]*$/) && richfaces.$(this)) {
parentElement = this;
return false;
}
}
});
if (parentElement !== false) {
return parentElement;
}
}
return sourceElement;
};
{code}
The problem is within the function "searchForComponentRootOrReturn" which in this special case of id-hierarchy evaluates to the wrong element. The correct element to be returned here would be the "sourceElement" (selectBooleanCheckbox with the id "treeNodeSelectBox" in the example above), but the code evaluates to a "parent" (treeNode in the example above) due to its id "treeNode" being a prefix of the component which fired the event.
It took me a whole day to figure that one out, since there is no useful output neither in a4j:log nor in server side logging in a case where the parameter "javax.faces.source" does not match the component id. In fact the AJAX request is executed just fine, only the event is never queued...
(See Mojarra HtmlBasicRenderer => decodeBehaviors and its check method isBehaviorSource)
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)
10 years, 3 months
[JBoss JIRA] (RF-13775) Depracated syntax used in RichFaces Resources Maven Plugin
by Brian Leathem (JIRA)
[ https://issues.jboss.org/browse/RF-13775?page=com.atlassian.jira.plugin.s... ]
Brian Leathem updated RF-13775:
-------------------------------
Original Estimate: 1 hour
Remaining Estimate: 1 hour
> Depracated syntax used in RichFaces Resources Maven Plugin
> ----------------------------------------------------------
>
> Key: RF-13775
> URL: https://issues.jboss.org/browse/RF-13775
> Project: RichFaces
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Affects Versions: 4.5.0.Alpha3
> Reporter: Pavol Pitonak
> Priority: Trivial
> Fix For: 4.5.0.Beta1
>
> Original Estimate: 1 hour
> Remaining Estimate: 1 hour
>
> During the build of Resources Maven Plugin these warnings are displayed:
> {code}
> [WARNING] org.richfaces.resource.plugin.ProcessMojo#compress:
> [WARNING] The syntax
> [WARNING] @parameter expression="${property}"
> [WARNING] is deprecated, please use
> [WARNING] @parameter property="property"
> [WARNING] instead.
> [WARNING] org.richfaces.resource.plugin.ProcessMojo#encoding:
> [WARNING] The syntax
> [WARNING] @parameter expression="${property}"
> [WARNING] is deprecated, please use
> [WARNING] @parameter property="property"
> [WARNING] instead.
> [WARNING] org.richfaces.resource.plugin.ProcessMojo#pack:
> [WARNING] The syntax
> [WARNING] @parameter expression="${property}"
> [WARNING] is deprecated, please use
> [WARNING] @parameter property="property"
> [WARNING] instead.
> [WARNING] org.richfaces.resource.plugin.ProcessMojo#project:
> [WARNING] The syntax
> [WARNING] @parameter expression="${property}"
> [WARNING] is deprecated, please use
> [WARNING] @parameter property="property"
> [WARNING] instead.
> [WARNING] org.richfaces.resource.plugin.ProcessMojo#skins:
> [WARNING] The syntax
> [WARNING] @parameter expression="${property}"
> [WARNING] is deprecated, please use
> [WARNING] @parameter property="property"
> [WARNING] instead.
> [WARNING] org.richfaces.resource.plugin.ProcessMojo#staticResourceMappingFile:
> [WARNING] The syntax
> [WARNING] @parameter expression="${property}"
> [WARNING] is deprecated, please use
> [WARNING] @parameter property="property"
> [WARNING] instead.
> [WARNING] org.richfaces.resource.plugin.ProcessMojo#staticResourcePrefix:
> [WARNING] The syntax
> [WARNING] @parameter expression="${property}"
> [WARNING] is deprecated, please use
> [WARNING] @parameter property="property"
> [WARNING] instead.
> {code}
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)
10 years, 3 months
[JBoss JIRA] (RF-13775) Depracated syntax used in RichFaces Resources Maven Plugin
by Brian Leathem (JIRA)
[ https://issues.jboss.org/browse/RF-13775?page=com.atlassian.jira.plugin.s... ]
Brian Leathem updated RF-13775:
-------------------------------
Original Estimate: 30 minutes (was: 1 hour)
Remaining Estimate: 30 minutes (was: 1 hour)
> Depracated syntax used in RichFaces Resources Maven Plugin
> ----------------------------------------------------------
>
> Key: RF-13775
> URL: https://issues.jboss.org/browse/RF-13775
> Project: RichFaces
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Affects Versions: 4.5.0.Alpha3
> Reporter: Pavol Pitonak
> Priority: Trivial
> Fix For: 4.5.0.Beta1
>
> Original Estimate: 30 minutes
> Remaining Estimate: 30 minutes
>
> During the build of Resources Maven Plugin these warnings are displayed:
> {code}
> [WARNING] org.richfaces.resource.plugin.ProcessMojo#compress:
> [WARNING] The syntax
> [WARNING] @parameter expression="${property}"
> [WARNING] is deprecated, please use
> [WARNING] @parameter property="property"
> [WARNING] instead.
> [WARNING] org.richfaces.resource.plugin.ProcessMojo#encoding:
> [WARNING] The syntax
> [WARNING] @parameter expression="${property}"
> [WARNING] is deprecated, please use
> [WARNING] @parameter property="property"
> [WARNING] instead.
> [WARNING] org.richfaces.resource.plugin.ProcessMojo#pack:
> [WARNING] The syntax
> [WARNING] @parameter expression="${property}"
> [WARNING] is deprecated, please use
> [WARNING] @parameter property="property"
> [WARNING] instead.
> [WARNING] org.richfaces.resource.plugin.ProcessMojo#project:
> [WARNING] The syntax
> [WARNING] @parameter expression="${property}"
> [WARNING] is deprecated, please use
> [WARNING] @parameter property="property"
> [WARNING] instead.
> [WARNING] org.richfaces.resource.plugin.ProcessMojo#skins:
> [WARNING] The syntax
> [WARNING] @parameter expression="${property}"
> [WARNING] is deprecated, please use
> [WARNING] @parameter property="property"
> [WARNING] instead.
> [WARNING] org.richfaces.resource.plugin.ProcessMojo#staticResourceMappingFile:
> [WARNING] The syntax
> [WARNING] @parameter expression="${property}"
> [WARNING] is deprecated, please use
> [WARNING] @parameter property="property"
> [WARNING] instead.
> [WARNING] org.richfaces.resource.plugin.ProcessMojo#staticResourcePrefix:
> [WARNING] The syntax
> [WARNING] @parameter expression="${property}"
> [WARNING] is deprecated, please use
> [WARNING] @parameter property="property"
> [WARNING] instead.
> {code}
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)
10 years, 3 months
[JBoss JIRA] (RF-13775) Depracated syntax used in RichFaces Resources Maven Plugin
by Brian Leathem (JIRA)
[ https://issues.jboss.org/browse/RF-13775?page=com.atlassian.jira.plugin.s... ]
Brian Leathem updated RF-13775:
-------------------------------
Sprint: 4.5.0.Beta1 - Upgrade Sprint
> Depracated syntax used in RichFaces Resources Maven Plugin
> ----------------------------------------------------------
>
> Key: RF-13775
> URL: https://issues.jboss.org/browse/RF-13775
> Project: RichFaces
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Affects Versions: 4.5.0.Alpha3
> Reporter: Pavol Pitonak
> Priority: Trivial
> Fix For: 4.5.0.Beta1
>
> Original Estimate: 30 minutes
> Remaining Estimate: 30 minutes
>
> During the build of Resources Maven Plugin these warnings are displayed:
> {code}
> [WARNING] org.richfaces.resource.plugin.ProcessMojo#compress:
> [WARNING] The syntax
> [WARNING] @parameter expression="${property}"
> [WARNING] is deprecated, please use
> [WARNING] @parameter property="property"
> [WARNING] instead.
> [WARNING] org.richfaces.resource.plugin.ProcessMojo#encoding:
> [WARNING] The syntax
> [WARNING] @parameter expression="${property}"
> [WARNING] is deprecated, please use
> [WARNING] @parameter property="property"
> [WARNING] instead.
> [WARNING] org.richfaces.resource.plugin.ProcessMojo#pack:
> [WARNING] The syntax
> [WARNING] @parameter expression="${property}"
> [WARNING] is deprecated, please use
> [WARNING] @parameter property="property"
> [WARNING] instead.
> [WARNING] org.richfaces.resource.plugin.ProcessMojo#project:
> [WARNING] The syntax
> [WARNING] @parameter expression="${property}"
> [WARNING] is deprecated, please use
> [WARNING] @parameter property="property"
> [WARNING] instead.
> [WARNING] org.richfaces.resource.plugin.ProcessMojo#skins:
> [WARNING] The syntax
> [WARNING] @parameter expression="${property}"
> [WARNING] is deprecated, please use
> [WARNING] @parameter property="property"
> [WARNING] instead.
> [WARNING] org.richfaces.resource.plugin.ProcessMojo#staticResourceMappingFile:
> [WARNING] The syntax
> [WARNING] @parameter expression="${property}"
> [WARNING] is deprecated, please use
> [WARNING] @parameter property="property"
> [WARNING] instead.
> [WARNING] org.richfaces.resource.plugin.ProcessMojo#staticResourcePrefix:
> [WARNING] The syntax
> [WARNING] @parameter expression="${property}"
> [WARNING] is deprecated, please use
> [WARNING] @parameter property="property"
> [WARNING] instead.
> {code}
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)
10 years, 3 months
[JBoss JIRA] (RF-13775) Depracated syntax used in RichFaces Resources Maven Plugin
by Brian Leathem (JIRA)
[ https://issues.jboss.org/browse/RF-13775?page=com.atlassian.jira.plugin.s... ]
Brian Leathem commented on RF-13775:
------------------------------------
Thanks [~ppitonak]. I'd like to take it one step further and replace the javadoc xdoclet usage with Annotations as we did with the CDK: https://github.com/richfaces/richfaces-cdk/commit/0e33b866f61dd5e2b707e9f.... I'll schedule this for the current sprint.
> Depracated syntax used in RichFaces Resources Maven Plugin
> ----------------------------------------------------------
>
> Key: RF-13775
> URL: https://issues.jboss.org/browse/RF-13775
> Project: RichFaces
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Affects Versions: 4.5.0.Alpha3
> Reporter: Pavol Pitonak
> Priority: Trivial
> Fix For: 4.5.0.Beta1
>
>
> During the build of Resources Maven Plugin these warnings are displayed:
> {code}
> [WARNING] org.richfaces.resource.plugin.ProcessMojo#compress:
> [WARNING] The syntax
> [WARNING] @parameter expression="${property}"
> [WARNING] is deprecated, please use
> [WARNING] @parameter property="property"
> [WARNING] instead.
> [WARNING] org.richfaces.resource.plugin.ProcessMojo#encoding:
> [WARNING] The syntax
> [WARNING] @parameter expression="${property}"
> [WARNING] is deprecated, please use
> [WARNING] @parameter property="property"
> [WARNING] instead.
> [WARNING] org.richfaces.resource.plugin.ProcessMojo#pack:
> [WARNING] The syntax
> [WARNING] @parameter expression="${property}"
> [WARNING] is deprecated, please use
> [WARNING] @parameter property="property"
> [WARNING] instead.
> [WARNING] org.richfaces.resource.plugin.ProcessMojo#project:
> [WARNING] The syntax
> [WARNING] @parameter expression="${property}"
> [WARNING] is deprecated, please use
> [WARNING] @parameter property="property"
> [WARNING] instead.
> [WARNING] org.richfaces.resource.plugin.ProcessMojo#skins:
> [WARNING] The syntax
> [WARNING] @parameter expression="${property}"
> [WARNING] is deprecated, please use
> [WARNING] @parameter property="property"
> [WARNING] instead.
> [WARNING] org.richfaces.resource.plugin.ProcessMojo#staticResourceMappingFile:
> [WARNING] The syntax
> [WARNING] @parameter expression="${property}"
> [WARNING] is deprecated, please use
> [WARNING] @parameter property="property"
> [WARNING] instead.
> [WARNING] org.richfaces.resource.plugin.ProcessMojo#staticResourcePrefix:
> [WARNING] The syntax
> [WARNING] @parameter expression="${property}"
> [WARNING] is deprecated, please use
> [WARNING] @parameter property="property"
> [WARNING] instead.
> {code}
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)
10 years, 3 months
[JBoss JIRA] (RF-13775) Depracated syntax used in RichFaces Resources Maven Plugin
by Brian Leathem (JIRA)
[ https://issues.jboss.org/browse/RF-13775?page=com.atlassian.jira.plugin.s... ]
Brian Leathem updated RF-13775:
-------------------------------
Fix Version/s: 4.5.0.Beta1
> Depracated syntax used in RichFaces Resources Maven Plugin
> ----------------------------------------------------------
>
> Key: RF-13775
> URL: https://issues.jboss.org/browse/RF-13775
> Project: RichFaces
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Affects Versions: 4.5.0.Alpha3
> Reporter: Pavol Pitonak
> Priority: Trivial
> Fix For: 4.5.0.Beta1
>
>
> During the build of Resources Maven Plugin these warnings are displayed:
> {code}
> [WARNING] org.richfaces.resource.plugin.ProcessMojo#compress:
> [WARNING] The syntax
> [WARNING] @parameter expression="${property}"
> [WARNING] is deprecated, please use
> [WARNING] @parameter property="property"
> [WARNING] instead.
> [WARNING] org.richfaces.resource.plugin.ProcessMojo#encoding:
> [WARNING] The syntax
> [WARNING] @parameter expression="${property}"
> [WARNING] is deprecated, please use
> [WARNING] @parameter property="property"
> [WARNING] instead.
> [WARNING] org.richfaces.resource.plugin.ProcessMojo#pack:
> [WARNING] The syntax
> [WARNING] @parameter expression="${property}"
> [WARNING] is deprecated, please use
> [WARNING] @parameter property="property"
> [WARNING] instead.
> [WARNING] org.richfaces.resource.plugin.ProcessMojo#project:
> [WARNING] The syntax
> [WARNING] @parameter expression="${property}"
> [WARNING] is deprecated, please use
> [WARNING] @parameter property="property"
> [WARNING] instead.
> [WARNING] org.richfaces.resource.plugin.ProcessMojo#skins:
> [WARNING] The syntax
> [WARNING] @parameter expression="${property}"
> [WARNING] is deprecated, please use
> [WARNING] @parameter property="property"
> [WARNING] instead.
> [WARNING] org.richfaces.resource.plugin.ProcessMojo#staticResourceMappingFile:
> [WARNING] The syntax
> [WARNING] @parameter expression="${property}"
> [WARNING] is deprecated, please use
> [WARNING] @parameter property="property"
> [WARNING] instead.
> [WARNING] org.richfaces.resource.plugin.ProcessMojo#staticResourcePrefix:
> [WARNING] The syntax
> [WARNING] @parameter expression="${property}"
> [WARNING] is deprecated, please use
> [WARNING] @parameter property="property"
> [WARNING] instead.
> {code}
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)
10 years, 3 months