我有一个PrimeFaces <p:commandButton update=":messages"
其发送的形式后不显示p:messages
,但如果使用update="@all"
代替它更新p:messages
,我可以看到显示的消息。primefaces号码:的commandButton更新属性未能更新号码:消息组件
我试过很多其他组合,如update="messages"
,update="NewRegistryForm:messages"
,update="@form :messages"
,render=":messages"
......但没有别的似乎工作。任何想法为什么这可能会发生?
在RegistryInputNewBean.processRequest
我简单地更新信息组件是这样的:
FacesContext.getCurrentInstance().addMessage(
null,
new FacesMessage(FacesMessage.SEVERITY_ERROR, "", "error_processing_request")
);
mytemplate.xhtml
,含p:messages
,是这样的:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
lang="en"
>
<f:view contentType="text/html" encoding="UTF-8" locale="en">
<h:head>
<title>test</title>
</h:head>
<h:body id="pageBody">
<p:messages id="messages" showDetail="true" autoUpdate="true" closable="true" showSummary="false"/>
<ui:insert name="content" />
</h:body>
</f:view>
</html>
myform.xhtml
是这样的:
<!DOCTYPE html>
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
>
<ui:define name="content">
<ui:composition template="mytemplate.xhtml">
<h:form id="NewRegistryForm">
<p:commandButton
id="sendButton"
type="submit"
action="#{registryInputNewBean.processRequest}"
update="@all"
style="display:none" />
</h:form>
</ui:composition>
</ui:define>
</html>
更新组件是你可以,但会导致不同于在'p:commandButton'上使用'update'的行为? –