Template template = templateContext.getTemplate();
if (LOG.isDebugEnabled()) {
LOG.debug("Trying to render template " + template + ", repeating through parents until we succeed");
}
UIBean tag = templateContext.getTag();
ValueStack stack = templateContext.getStack();
stack.push(tag);
PageContext pageContext = (PageContext) stack.getContext().get(ServletActionContext.PAGE_CONTEXT);
List templates = template.getPossibleTemplates(this);
Exception exception = null;
boolean success = false;
for (Iterator iterator = templates.iterator(); iterator.hasNext();) {
Template t = (Template) iterator.next();
try {
Include.include(getFinalTemplateName(t), pageContext.getOut(),
pageContext.getRequest(), (HttpServletResponse) pageContext.getResponse());
success = true;
break;
} catch (Exception e) {
if (exception == null) {
exception = e;
}
}
}
if (!success) {
LOG.error("Could not render JSP template " + templateContext.getTemplate());
if (exception != null) {
throw exception;
} else {
return;
}
}
stack.pop();