jsf 2 - "empty" IllegalArgumentException with nested JSF h:panelGroups and f:ajax -
i'm having problems updating inner nested h:panelgroup
element using f:ajax
. have minimized problem following example:
<h:form id="someform"> <h:panelgroup id="wrapper"> <h:panelgroup id="content"> content </h:panelgroup> </h:panelgroup> <h:commandlink action="#{bean.changecontent()}" value="do something"> <f:ajax render=":someform:wrapper:content"/> </h:commandlink> </h:form>
when try open page, findcomponent
method throws illegalargumentexception
no further information:
severe: error rendering view[/view/group/invitation/testcase.xhtml] java.lang.illegalargumentexception: wrapper @ javax.faces.component.uicomponentbase.findcomponent(uicomponentbase.java:655) @ com.sun.faces.renderkit.html_basic.ajaxbehaviorrenderer.getresolvedid(ajaxbehaviorrenderer.java:302) @ com.sun.faces.renderkit.html_basic.ajaxbehaviorrenderer.appendids(ajaxbehaviorrenderer.java:292) @ com.sun.faces.renderkit.html_basic.ajaxbehaviorrenderer.buildajaxcommand(ajaxbehaviorrenderer.java:225) @ com.sun.faces.renderkit.html_basic.ajaxbehaviorrenderer.getscript(ajaxbehaviorrenderer.java:89) ...
i looked implementation , found following section causing exception:
... result = findcomponent(base, segments[i], (i == 0)); // first element of expression may match base.id // (vs. child if of base) if (i == 0 && result == null && segments[i].equals(base.getid())) { result = base; } if (result != null && (!(result instanceof namingcontainer)) && length > 0) { throw new illegalargumentexception(segments[i]); } ...
i debugged program, component found (by first line of code above), conclusion h:panelgroup
not instance of namingcontainer
, after reading this post , checking generated html other examples understanding h:panelgroup
naming container. however, when remove wrapper , tell ajax element update content
panelgroup
directly, no exception thrown. don't understand method jsf uses search through elements, i'd appreciate if explain me why tiny example behaves way. using mojarra 2.2.0 on glassfish 4.0
when want update/render component same h:form
don't need attach form id component id.
in case
<f:ajax render="content"/>
would job you.
and h:panelgroup
not namingcontainer component. dont need refer inner components of h:panelgroup
nesting id.
so <h:panelgroup id="content">
can referred out side form someform:content
.
someform:wrapper:content
wrong thing. reason getting exception.
you can find out generated component id on browser right click , inpect element.
Comments
Post a Comment