*/
public int doEndTag() throws JspTagException {
Object bean = Factory.lookup(getBean());
if (bean != null) {
if (bean instanceof UIComponentHandlerFactoryElement) {
UIComponentHandlerFactoryElement uiBean = (UIComponentHandlerFactoryElement) bean;
String page = uiBean.getComponentIncludeJSP();
if (page == null) log.error("Page for component " + getBean() + " is null.");
CodeBlockTrace trace = new HandlerFactoryElement.HandlerTrace(uiBean, null).begin();
Object previousComponent = pageContext.getRequest().getAttribute(COMPONENT_ATTR_NAME);
try {
uiBean.beforeRenderComponent();
pageContext.getRequest().setAttribute(COMPONENT_ATTR_NAME, bean);
jspInclude(page);
pageContext.getRequest().setAttribute(COMPONENT_ATTR_NAME, previousComponent);
uiBean.afterRenderComponent();
} catch (Exception e) {
handleError(e);
} finally {
pageContext.getRequest().setAttribute(COMPONENT_ATTR_NAME, previousComponent);
trace.end();