ATG Log Error from JSP Page

"The page cannot be displayed" | Flickr

"The page cannot be displayed" by Peter Kaminski

Unlike this IKEA sign, you usually don’t want to display errors on your web pages.  ATG allows you to log errors to the server log from a JSP page.  Below is an example of how to do this.  In this case if we find the price is null we log an error to the server log.

<dsp:getvalueof id="price" idtype="java.lang.Double" param="currentItem.priceInfo.amount">
<%
if (price == null) {
atg.servlet.DynamoHttpServletRequest dreq = atg.servlet.ServletUtil.getDynamoRequest(request);
dreq.logError("price is null!”);
}
%>
</dsp:getvalueof>

Leave a Reply

Your email address will not be published. Required fields are marked *