@Override public void doTag() throws JspException { Object disabled = this.getJspContext().getAttribute(AnchorDecorator.ANCHORS_DISABLED, PageContext.REQUEST_SCOPE); if ("TRUE".equalsIgnoreCase(StringUtils.toString(disabled))) { return; } try { Anchor[] anchors = (Anchor[])getJspContext().findAttribute(AnchorDecorator.ANCHORS); anchors = (anchors == null) ? new Anchor[0] : anchors; if (anchors.length > 0) { getJspContext().getOut().print(before); } for (Anchor anchor : anchors) { String out = each; out = out.replaceAll("anchor.name", anchor.getName()); out = out.replaceAll("anchor.title", anchor.getTitle()); getJspContext().getOut().print(out); } if (anchors.length > 0) { getJspContext().getOut().print(after); } } catch (Exception ex) { throw new JspException("Exception executing tag", ex); } }