You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Volker Weber <v....@inexso.de> on 2010/01/20 14:37:17 UTC
Re: FacesMessage with severity ERROR do not prevent calling an action
method
Hi Madhav,
the livecycle did not depend on messages in the context. To prevent
executing actions and direct skip to renderPhase you need to call
FacesContext.getCurrentInstance().renderResponse();
e.g. in your putMessage() method.
Regards,
Volker
2010/1/20 Madhav Bhargava <Ma...@infosys.com>:
> Hi,
>
> I am using myfaces 1.1, icefaces 1.8.1 on WAS 6.0
>
> The controller (backing bean) action methods handle RuntimeException from the service layer. Depending on the exception an exception handler will put an appropriate message into FacesContext.
> For that I have created a utility method:
>
> public static void putMessage(String key, Severity severity,
> String summary, String detail) {
> FacesContext.getCurrentInstance().addMessage(key,
> new FacesMessage(severity, summary, detail));
> }
>
> In the controller this method is used to put messages. When the page is displayed the messages appear properly. However when a user clicks on a commandButton then the control goes to the action method bound to the commandButton. This should not happen because there are FacesMessages with FacesMessage.SEVERITY_ERROR. I checked immediate="true" has not been set on the commandButton component.
>
> Is my understanding not correct that if there are FacesMessages with Severity = SEVERITY_ERROR in the FacesContext then the invoke application phase will not happen and the control would come back to the current page in error?
>
> Regards,
> Madhav
>
> **************** CAUTION - Disclaimer *****************
> This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely
> for the use of the addressee(s). If you are not the intended recipient, please
> notify the sender by e-mail and delete the original message. Further, you are not
> to copy, disclose, or distribute this e-mail or its contents to any other person and
> any such actions are unlawful. This e-mail may contain viruses. Infosys has taken
> every reasonable precaution to minimize this risk, but is not liable for any damage
> you may sustain as a result of any virus in this e-mail. You should carry out your
> own virus checks before opening the e-mail or attachment. Infosys reserves the
> right to monitor and review the content of all messages sent to or from this e-mail
> address. Messages sent to or from this e-mail address may be stored on the
> Infosys e-mail system.
> ***INFOSYS******** End of Disclaimer ********INFOSYS***
>
--
inexso - information exchange solutions GmbH
Bismarckstraße 13 | 26122 Oldenburg
Tel.: +49 441 4082 356 |
FAX: +49 441 4082 355 | www.inexso.de
RE: FacesMessage with severity ERROR do not prevent calling an
action method
Posted by Madhav Bhargava <Ma...@infosys.com>.
Hi Volkar,
Thanks for your response. I will add that to the method so that it does not have to be explicitly done by the developers in their action methods.
>From: weber.volker@googlemail.com [mailto:weber.volker@googlemail.com] On Behalf Of Volker Weber
>
>Hi Madhav,
>
>the livecycle did not depend on messages in the context. To prevent
>executing actions and direct skip to renderPhase you need to call
>
>FacesContext.getCurrentInstance().renderResponse();
>
>e.g. in your putMessage() method.
>
>
>Regards,
> Volker
>
2010/1/20 Madhav Bhargava <Ma...@infosys.com>:
> Hi,
>
> I am using myfaces 1.1, icefaces 1.8.1 on WAS 6.0
>
> The controller (backing bean) action methods handle RuntimeException from the service layer. Depending on the exception an exception handler will put an appropriate message into FacesContext.
> For that I have created a utility method:
>
> public static void putMessage(String key, Severity severity,
> String summary, String detail) {
> FacesContext.getCurrentInstance().addMessage(key,
> new FacesMessage(severity, summary, detail));
> }
>
> In the controller this method is used to put messages. When the page is displayed the messages appear properly. However when a user clicks on a commandButton then the control goes to the action method bound to the commandButton. This should not happen because there are FacesMessages with FacesMessage.SEVERITY_ERROR. I checked immediate="true" has not been set on the commandButton component.
>
> Is my understanding not correct that if there are FacesMessages with Severity = SEVERITY_ERROR in the FacesContext then the invoke application phase will not happen and the control would come back to the current page in error?
>
> Regards,
> Madhav
>
> **************** CAUTION - Disclaimer *****************
> This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely
> for the use of the addressee(s). If you are not the intended recipient, please
> notify the sender by e-mail and delete the original message. Further, you are not
> to copy, disclose, or distribute this e-mail or its contents to any other person and
> any such actions are unlawful. This e-mail may contain viruses. Infosys has taken
> every reasonable precaution to minimize this risk, but is not liable for any damage
> you may sustain as a result of any virus in this e-mail. You should carry out your
> own virus checks before opening the e-mail or attachment. Infosys reserves the
> right to monitor and review the content of all messages sent to or from this e-mail
> address. Messages sent to or from this e-mail address may be stored on the
> Infosys e-mail system.
> ***INFOSYS******** End of Disclaimer ********INFOSYS***
>
--
inexso - information exchange solutions GmbH
Bismarckstraße 13 | 26122 Oldenburg
Tel.: +49 441 4082 356 |
FAX: +49 441 4082 355 | www.inexso.de