Content Delivery web service error handling JSP example
JSP example that catches any exception raised by the web service and displays it on the webpage.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ taglib uri="http://www.sdl.com/delivery/tags/cd/2.0" prefix="tridion" %>
<%@page import="com.tridion.ugc.taglib.util.TagUtils,
java.util.List"%>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:tridion="http://www.tridion.com/ContentManager/5.0">
<head>
<title>Exception catching test page</title>
</head>
<body>
// Insert Web service calls here.
<br/>
<%
Object errors= pageContext.getAttribute(TagUtils.ERRORS, PageContext.REQUEST_SCOPE);
if (errors != null) {
out.println("<h1>Errors:</h1>");
List<Exception> errorList = (List<Exception>) errors;
for (Exception ex : errorList) {
out.println("<br/>" + ex.getMessage());
}
}
%>
</body>
</html>