在使用RichFaces标签开发遇到一个问题,就是在弹窗页面(使用rich:popupPanel标签包裹的xhtml页面)点击按钮(a4j:commandButton)打开另一个弹窗页面,第一次点击按钮的时候按钮的action事件(<a4j:commandButton action="#{action.method()}" ...)并没有执行,第二次点击按钮时才执行。
需要在打开弹窗界面时,同时把弹窗页面里面的 <h:form>标签渲染,这样在这个弹窗页面里点击按钮的action事件,点击一次就可以执行了。
第一个弹窗页面部分代码:
主页面代码(打开第一个弹窗):
mark.....
http://www.it1352.com/52369.html
需要在打开弹窗界面时,同时把弹窗页面里面的 <h:form>标签渲染,这样在这个弹窗页面里点击按钮的action事件,点击一次就可以执行了。
第一个弹窗页面部分代码:
<rich:popupPanel id="OpenCloseLinkBatchEditMP" width="850" height="400" resizeable="false" moveable="true">
<f:facet name="header">Open &Close Link #{i19n.translate('elm.base.ejc')}</f:facet>
<h:form id="DVFormLink">
<h:message id="errorMessage" for="errorMessages"></h:message>
<s:decorate id="errorMessagesDec">
<h:messages id="errorMessages" style="color: red;"></h:messages>
</s:decorate>
<rich:panel style="width:97%; border:0;">
<h:panelGrid columns="2" width="90%">
<s:decorate id="orgSelectDec"
template="/layout/edit.xhtml">
<ui:define name="label">#{messages['STATIC_LABEL.SUB_DEPARTMENT']}</ui:define>
<h:inputText id="SubDepartmentId" value="#{openCloseEditAction.sdeptIds}" style="display:none;">
</h:inputText>
<h:outputText id="SubDepartmentName" style="position:relative;top:-6px;"
value="#{staffingParamsTool.calOrgNames(openCloseEditAction.sdeptIds)}" />
<h:graphicImage value="/img/blank.png" width="5px" />
<a4j:commandButton
id="orgTreeLink" value="#{messages['STATIC_LABEL.ORG_SELECTOR']}"
type="image" image="/img/org.png"
action="#{subDepartmentSelectTool.setInputBoxTags('DVFormLink:orgSelectDec:SubDepartmentId','DVFormLink:orgSelectDec:SubDepartmentName','DVFormLink:PosSelectDec','openCloseEditAction.callbackFromSelectOrgs',openCloseEditAction.sdeptIds)}"
oncomplete="#{rich:component('ReduceFocusToolMultiStoreMP')}.show();"
render="reduceFocusToolFormMultiStore, selectedForm"
ajaxSingle="false" />
</s:decorate>
主页面代码(打开第一个弹窗):
<a4j:commandButton value="#{messages['STATIC_LABEL.LINK_TO']}" render="OpenCloseLinkBatchEditMP,DVFormLink" execute="@this" oncomplete="#{rich:component('OpenCloseLinkBatchEditMP')}.show();"
action="#{openCloseEditAction.batchLink2Ejc()}"
rendered="#{openCloseAction.viewDataMode == 0}">
mark.....
http://www.it1352.com/52369.html