/**
* @see javax.servlet.jsp.tagext.TagSupport
*/
public int doEndTag() throws JspTagException {
UIBeanHandler uiBean = getBeanInstance();
String page = uiBean.getBeanJSP();
if (StringUtils.isBlank(page)) throw new RuntimeException("Page for bean " + getBeanName() + " is null.");
CodeBlockTrace trace = new BeanHandler.HandlerTrace(uiBean, null).begin();
Object previousComponent = pageContext.getRequest().getAttribute(CURRENT_BEAN);
try {
uiBean.beforeRenderBean();
pageContext.getRequest().setAttribute(CURRENT_BEAN, uiBean);
jspInclude(page);
pageContext.getRequest().setAttribute(CURRENT_BEAN, previousComponent);
uiBean.afterRenderBean();
} catch (Exception e) {
handleError(e);
} finally {
pageContext.getRequest().setAttribute(CURRENT_BEAN, previousComponent);
trace.end();