Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic