myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Madhav Bhargava <Madhav_Bharg...@infosys.com>
Subject RE: FacesMessage with severity ERROR do not prevent calling an action method
Date Wed, 20 Jan 2010 13:48:40 GMT
True, you are right.
The problem was that the first request goes as an AJAX request submitting on a part of the
form. If there are errors, messages are shown. Now the user clicks on any other control which
submits the rest of the page barring the one which was previously submitted. That caused the
action to be executed as expected because that part of the page is never submitted.

Sorry for the confusion and thanks a lot for your response.

Regards,
Madhav

>From: Michael Kurz [mailto:michi.kurz@gmx.at] 
>Sent: Wednesday, January 20, 2010 7:05 PM
>
>Hi,
>
>for clearification: does the click on the command button take place 
>AFTER the page with the error messages was rendered? Because if it is 
>so, this is the expected behavior. The messages in the FacesContext are 
>only available for the current request, which is the one producing the 
>error. If you click on a command button on this page a new request with 
>a new FacesContext is started. Unless this produces the same error the 
>messages will be gone.
>
>regards
>Michael
>
>Madhav Bhargava schrieb:
> 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***
> 


Mime
View raw message