我包含了一个带有通用 ID 的模板
<ui:include src="./buttons.xhtml">
<ui:param name="action" value="#{bean.nextSessionId()}" />
</ui:include>
按钮.xhtml
<ui:composition>
hello-#{action}-#{action}
</ui:composition>
输出
hello-obcpusp90m7653vci7ohh87aa3-vcv63aj2h8h8gak3dhb5do0
bean 是 viewscoped
private SecureRandom random = new SecureRandom();
public String nextSessionId()
{
return new BigInteger(130, random).toString(32);
}
为什么id不等于?
我需要这个 id
<p:commandButton id="basic#{action}" value="Basic" onclick="dlg1#{action}.show()" type="button" process="@this"/>
<p:confirmDialog id="id#{action}" widgetVar="dlg1#{action}">
<p:inputText value="....."/>
<p:commandButton oncomplete="dlg1#{action}.hide()" value="Close"/>
</p:confirmDialog>