You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Julien Martin <ba...@gmail.com> on 2007/12/11 09:59:08 UTC
for attribute of h:message
Hello,
Suppose I have two h:forms each with one h:command button, all of which are
on a jsf page. I would like to find a way to display error messages with two
h:message components each working for a given h:command button but it seems
that the for attribute of a h:message can't point to a h:command button.
What is the best way of achieving the desired behavior?
Julien.
<h:form id="companies-netting-process-form">
<h:message showDetail="true" showSummary="true"
for="companies-netting-process-form"/>
<h:commandButton id="companies-netting-process-button" action="#{
NettingManagedBean.copyCompanies}" value="Traitement netting companies" />
</h:form>
<f:verbatim>
<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
</f:verbatim>
<h:form id="amounts-netting-process-form">
<h:message showDetail="true" showSummary="true"
for="amounts-netting-process-form"/>
<h:commandButton id="amounts-netting-process-button" action="#{
NettingManagedBean.copyAmounts}" value="Traitement netting amounts" />
</h:form>
Re: for attribute of h:message
Posted by Julien Martin <ba...@gmail.com>.
Hello Simon,
Good pointer! Here is what I tried :
FacesContext.getCurrentInstance().addMessage("companies-netting-process-button",
new FacesMessage(FacesMessage.SEVERITY_ERROR, "Erreur lors de la copie",
ex.getMessage()));
Here is what I now get (as if it would not locate the comand button)
INFO: WARNING: FacesMessage(s) have been enqueued, but may not have been
displayed.
sourceId=amounts-netting-process-button[severity=(ERROR 2), summary=(Erreur
lors de la copie), detail=([SQL0803] Duplicate key value specified.)]
java.sql.SQLException: [SQL0803] Duplicate key value specified.
2007/12/11, Julien Martin <ba...@gmail.com>:
>
> Hello,
>
> Suppose I have two h:forms each with one h:command button, all of which
> are on a jsf page. I would like to find a way to display error messages with
> two h:message components each working for a given h:command button but it
> seems that the for attribute of a h:message can't point to a h:command
> button. What is the best way of achieving the desired behavior?
> Julien.
>
>
> <h:form id="companies-netting-process-form">
> <h:message showDetail="true" showSummary="true"
> for="companies-netting-process-form"/>
> <h:commandButton id="companies-netting-process-button" action="#{
> NettingManagedBean.copyCompanies}" value="Traitement netting companies" />
>
> </h:form>
>
> <f:verbatim>
> <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
> </f:verbatim>
>
> <h:form id="amounts-netting-process-form">
> <h:message showDetail="true" showSummary="true"
> for="amounts-netting-process-form"/>
> <h:commandButton id="amounts-netting-process-button" action="#{
> NettingManagedBean.copyAmounts}" value="Traitement netting amounts" />
> </h:form>
>