public class CustomPageTitleTag extends TagSupport {
@Override
public int doStartTag() throws JspException {
ServletRequest request = this.pageContext.getRequest();
RequestContext reqCtx = (RequestContext) request.getAttribute(RequestContext.REQCTX);
try {
if (null != this.getTitle() && this.getTitle().trim().length() > 0) {
reqCtx.addExtraParam(SystemConstants.EXTRAPAR_EXTRA_PAGE_TITLES, this.getTitle());
} else if (null != this.getLabelKey() && this.getLabelKey().trim().length() > 0) {
II18nManager i18nManager = (II18nManager) ApsWebApplicationUtils.getBean(SystemConstants.I18N_MANAGER, this.pageContext);
ApsProperties titles = i18nManager.getLabelGroups().get(this.getLabelKey());
if (null != titles) {
reqCtx.addExtraParam(SystemConstants.EXTRAPAR_EXTRA_PAGE_TITLES, titles);
} else {
reqCtx.addExtraParam(SystemConstants.EXTRAPAR_EXTRA_PAGE_TITLES, this.getLabelKey());
}
}
} catch (Throwable t) {
ApsSystemUtils.logThrowable(t, this, "doStartTag");
throw new JspException("Error during tag initialization", t);