sta*_*ker 2 jsf seam richfaces
我面临与此处描述的相同的问题Rich modalpanel会自动关闭
我正在使用richfaces 3.3.0(包含在接缝2.12中).我试图找出问题所在,Firebug显示在modalpanel出现后,会生成对服务器的请求.面板在几毫秒后关闭.我为rich_modalPanel标签(在窗体外部)中的几个位置进行了多处理.
有任何想法吗?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:rich="http://richfaces.org/rich"
xmlns:a="http://richfaces.org/a4j"
xmlns:s="http://jboss.com/products/seam/taglib">
<head />
<body id="pgHome">
<f:view>
<div id="document">
<h:form id="login">
<fieldset>
<h:outputLabel id="UsernameLabel" for="username">Login Name</h:outputLabel>
<h:inputText id="username" value="#{identity.username}" style="width: 175px;" />
</fieldset>
<h:commandButton id="search2" value="modal"
onclick="#{rich:component('mp')}.show()" />
</h:form>
<rich:modalPanel id="mp" height="200" width="500">
<f:facet name="header">
<h:outputText value="Modal Panel Title" />
</f:facet>
</rich:modalPanel>
</div>
</f:view>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
编辑:
我终于使用了这个例子:
<rich:modalPanel id="modalPanelID">
<f:facet name="header">
<h:outputText value="header" />
</f:facet>
<a onclick="Richfaces.hideModalPanel('modalPanelID');" href="#">Hide</a>
</rich:modalPanel>
<a onclick="Richfaces.showModalPanel('modalPanelID');" href="#">Show</a>
Run Code Online (Sandbox Code Playgroud)
这种行为是正常的,因为您ModalPanel
使用以下代码使用commandButton 显示:
<h:commandButton id="search2" value="modal" onclick="#{rich:component('mp')}.show()" />
Run Code Online (Sandbox Code Playgroud)
在commandButton
将显示ModalPanel
,并随后将提交表单.这将强制页面完全重新显示,这就是你得到这种行为的原因.
要解决您的问题,您必须return false;
在onclick
事件结束时,可以将其转换为显示模态面板,然后停止任何处理,即不要提交表单.要使用的代码如下:
<h:commandButton id="search2" value="modal" onclick="#{rich:component('mp')}.show(); return false;" />
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
7644 次 |
最近记录: |