JSF 渲染弹出窗口来自 manegbean 条件?
JSF rendering popup frow a manegbean condition?
我用它来在发生错误时在登录中显示消息:
<a4j:region rendered="#{usuario.fail == 1}">
<div class="alert alert-danger alert-dismissable"
style="width: 470px; margin: 10px auto;">
<button type="button" class="close" data-dismiss="alert"
aria-hidden="true">×</button>
Invalid user or password.
</div>
</a4j:region>
但是,我想显示一个弹出窗口,但是,这不起作用,我正在尝试这样的操作:
<h:outputScript rendered="#{usuario.fail == 1}">
#{rich:component('popup')}.show();
</h:outputScript>
<rich:popupPanel id="popup" modal="false" autosized="true" resizeable="false">
<f:facet name="header">
<h:outputText value="Simple popup panel" />
</f:facet>
<f:facet name="controls">
<h:outputLink value="#" onclick="#{rich:component('popup')}.hide(); return false;">
X
</h:outputLink>
</f:facet>
<p>Any content might be inside this panel.</p>
<p>
The popup panel is open and closed from the javascript function of component client side object. The following code
<a href="#" onclick="#{rich:component('popup')}.hide()">hide this panel</a>:
<f:verbatim>#</f:verbatim>{rich:component('popup')}.hide()
</p>
</rich:popupPanel>
我正在尝试这个例子:
有没有办法显示来自 manegedbean 的 return 的弹出窗口?
提前致谢!
您在创建 popupPanel 之前调用该函数,这就是您收到未定义错误的原因。
尽管您不必为了显示面板而渲染 JS 函数,您可以只显示面板:
<rich:popupPanel id="popup" show="#{usuario.fail == 1}" …>
…
</rich:popupPanel>
我用它来在发生错误时在登录中显示消息:
<a4j:region rendered="#{usuario.fail == 1}">
<div class="alert alert-danger alert-dismissable"
style="width: 470px; margin: 10px auto;">
<button type="button" class="close" data-dismiss="alert"
aria-hidden="true">×</button>
Invalid user or password.
</div>
</a4j:region>
但是,我想显示一个弹出窗口,但是,这不起作用,我正在尝试这样的操作:
<h:outputScript rendered="#{usuario.fail == 1}">
#{rich:component('popup')}.show();
</h:outputScript>
<rich:popupPanel id="popup" modal="false" autosized="true" resizeable="false">
<f:facet name="header">
<h:outputText value="Simple popup panel" />
</f:facet>
<f:facet name="controls">
<h:outputLink value="#" onclick="#{rich:component('popup')}.hide(); return false;">
X
</h:outputLink>
</f:facet>
<p>Any content might be inside this panel.</p>
<p>
The popup panel is open and closed from the javascript function of component client side object. The following code
<a href="#" onclick="#{rich:component('popup')}.hide()">hide this panel</a>:
<f:verbatim>#</f:verbatim>{rich:component('popup')}.hide()
</p>
</rich:popupPanel>
我正在尝试这个例子:
有没有办法显示来自 manegedbean 的 return 的弹出窗口?
提前致谢!
您在创建 popupPanel 之前调用该函数,这就是您收到未定义错误的原因。
尽管您不必为了显示面板而渲染 JS 函数,您可以只显示面板:
<rich:popupPanel id="popup" show="#{usuario.fail == 1}" …>
…
</rich:popupPanel>