データを含む Java オブジェクトがある場合にレンダリングしたい ap:outputPanel があります。オブジェクトが null の場合、パネルをレンダリングしたくありません。
<h:form id="treeform">
<p:outputPanel id="outputComponent" rendered="#{TreeViewController.compProfile}">
<div>
.........
</div>
</p:outputPanel>
</h:form>
public boolean getCompProfile()
{
if (cd == null)
{
return false;
}
else
{
return true;
}
}
コードが正常に機能していることに気付きました。オブジェクトが null の場合、ブール値は false になり、パネルは表示されません。しかし、私が見つけた問題は、Java オブジェクトが null であるかどうかに関係なく、AJAX 呼び出しを再度行うと、ブール値が常に false になることです。AJAX 呼び出しの後に p:outputPanel を何らかの方法で構成して、#{TreeViewController.compProfile}
プロパティをレンダリングするかどうかをチェックできますか?