-
1. Re: Components on included page are not re-rendered
kkn Jan 5, 2016 5:40 PM (in response to kkn)For some reason, I am not able to add (or maybe see after adding) my code here. Basically, the search button is on search.xhtml and listing is shown on add.xhtml and both are included in main.xhtml. Search commandButton is trying to render an outputpanel on add.xhtml and the section is not rendered.
main.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<span
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:a4j="http://richfaces.org/a4j"
>
<ui:composition>
<c:if test = "#{showSearch eq true}">
<ui:include src="search.xhtml" />
<ui:include src="add.xhtml" />
</c:if>
</ui:composition>
</span>
search.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<span
id="spanSearch"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
>
<ui:composition>
<a4j:commandButton
id="search"
value="Search"
onclick="javascript: resetPreviousValues();
if (validateSearch() == false) {
return false;
} else {
isAjaxSubmission = true;
}"
render="something"
oncomplete="javascript: setFocusToAddSection();"
action="${myBean.search}"
/>
</ui:composition>
</span>
add.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<span
id="spanAdd"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
>
<ui:composition>
<a4j:region>
<a4j:outputPanel id="something">
#{myBean.listing}
</a4j:outputPanel>
</a4j:region>
</ui:composition>
</span>
Thanks!
-
2. Re: Components on included page are not re-rendered
michpetrov Jan 6, 2016 6:38 AM (in response to kkn)Have you checked the response and the generated code? The panel may be rerendering but it may be empty. If it's not even in the response then the renderer didn't find it in the component tree (in which case the c:if evaluated to false).
Is there any limitation that a component on an included page cannot be part of render?
There isn't, but if you have a question like that you can just try changing the code to see if it helps instead of waiting for an answer.
-
3. Re: Components on included page are not re-rendered
kkn Jan 6, 2016 1:02 PM (in response to michpetrov)Thank you for the reply! Sorry for not mentioning this info in my previous post :( The panel does come in my response and the c:if condition is not evaluated to false as well. Also, I tried to move the panel in add.xhtml to search.xhtml and it worked! That means when both commandButton and panel are on same xhtml, it is working perfectly. But I cannot have that option as add.xhtml is a common file which I am using at multiple places. Having tried all my options and checking docs, lastly, I have posted my question here.
-
4. Re: Components on included page are not re-rendered
michpetrov Jan 7, 2016 4:01 AM (in response to kkn)So it's empty in the response? In that case there's a problem with the bean, have you tried changing the scope?