Java Reference
In-Depth Information
public void addNewSeats() throws Exception {
try {
final FacesMessage m = new
FacesMessage(FacesMessage.SEVERITY_INFO, "Done!", "Seats
facesContext.addMessage(null, m);
} catch (Exception e) {
final String errorMessage =
FacesMessage m = new
FacesMessage(FacesMessage.SEVERITY_ERROR, errorMessage,
"Error while saving data");
facesContext.addMessage(null, m);
private String getRootErrorMessage(Exception e) {
// Default to general error message that
registration failed.
String errorMessage = "Registration failed. See
server log for more information";
if (e == null) {
// This shouldn't happen, but return the
default messages
return errorMessage;
// Start with the exception and recurse to find the
root cause
Throwable t = e;
while (t != null) {
// Get the message from the Throwable class
errorMessage = t.getLocalizedMessage();
t = t.getCause();
Search WWH ::

Custom Search