jsf - Primefaces p:ajax调用后消息消失
问题描述
我的问题是p:messages
错误消息闪烁然后消失。我知道我在 h:commandButton 上的 ajax 清除了表单,但我需要将消息保留在表单中,并且我无法让我的方法以其他方式运行 IE p:commandButton
onclick。
我的 card.xhtml 模板中的 xhtml 代码片段:
<h:form id="cardForm">
<p:messages closable="true" id="msg">
<p:autoUpdate disabled="true"/>
</p:messages>
<h:commandButton
value="Add card to profile"
actionListener="#{cust.addCardToProfile('cards.xhtml')}"
rendered="#{not cart}">
<p:ajax oncomplete="addCardToProfile();" update=":cardForm:msg"/>
</h:commandButton>
<h:form>
如何正确运行我的“addCardToProfile();” -方法和更新消息,使其停留在屏幕上。
原始xhtml:
...
<p:remoteCommand name="addCard2OptionList"
actionListener="#{saml2IdPLoginController.addCard2OptionList}"/>
...
<p:outputPanel id="userCard">
<ui:define name="content">
<ui:include src="/WEB-INF/templates/card.xhtml"/>
</ui:define>
</p:outputPanel>
正如@Melloware 所建议的,它可能与RemoteCommand
组件有关。
解决方案
推荐阅读
- python - 使用 Python C 类型在 kernel32 上调用 GetPrivateProfileString
- java - 如何在 JSON 响应中的 2 个对象之间添加换行符?以及如何从 json 文件中删除 [ ] 方括号?
- python - 将列表与两个元组进行比较
- jenkins - 用于从 nexus 下载工件并使用 gradle 脚本将其放置在文件夹中的 Jenkins 脚本
- kubernetes - Calico 节点状态返回 Calico 进程未运行
- python - 将要选择/取消选择的列值定义为默认值
- python - 为什么垂直线坐标不同?
- python-3.x - 运行 AWS Lambda 函数以跨账户整理证书
- c# - 尝试在智能卡上生成密钥时出错
- reactjs - 反应和表格