Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Displaying FacesMessage when a RemoteException or SOAPException occurs

 
Daniel Conner
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With a web app I am working on, I need to Display a FacesMessage when a RemoteException or SOAPException occurs. I believe that the syntax is correct. I know I am getting a RemoteExcpetion and a SOAPException thrown because of the output I get to the console. I just am not sure why the FacesMessage is not being displayed. This is the code for the jsp:

<f:facet name="messages">
<af:message id="msg" />
</f:facet>

This is the relevant java code:

catch(RemoteException re) {
System.out.println("RemoteException error: " + re);
FacesMessage message = new FacesMessage("Error connecting to the server");
context.addMessage(null, message);
}
catch(SOAPException se) {

FacesMessage message = new FacesMessage("Error connecting to the server");
context.addMessage(null, message);
System.out.println("SOAPException error" + se);
}
 
Ravindra Rawat
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Add the following after adding the message.


context.renderResponse();
// This will stop further processing in JSF lifecycle.


Regards
Ravindra
 
If tomatoes are a fruit, then ketchup must be a jam. Taste this tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!