Content Delivery Web service error handling JSP example

JSP example that catches any exception raised by the Web service and displays it on the Web page.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ taglib uri="cd_tags" prefix="tridion" %>
<%@page import="com.tridion.tcdl.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>