/** * Internal action method. * * <p> * * @param req the current request * @return a map that contains the element settings */ public static Map<String, String> elementSettingTagAction(ServletRequest req) { CmsFlexController controller = CmsFlexController.getController(req); CmsObject cms = controller.getCmsObject(); // try to find element setting on the container element try { CmsContainerElementBean currentElement = OpenCms.getADEManager().getCurrentElement(req); currentElement.initResource(cms); return currentElement.getSettings(); } catch (CmsException e) { // most likely we are not in a container page LOG.debug(e.getLocalizedMessage(), e); return Collections.emptyMap(); } }
/** * @return SKIP_BODY * @see javax.servlet.jsp.tagext.Tag#doStartTag() */ @Override public int doStartTag() throws JspException { ServletRequest req = pageContext.getRequest(); // This will always be true if the page is called through OpenCms if (CmsFlexController.isCmsRequest(req)) { try { String setting = elementSettingTagAction(getName(), m_defaultValue, m_escapeHtml, req); // Make sure that no null String is returned if (setting == null) { setting = ""; } pageContext.getOut().print(setting); } catch (Exception ex) { if (LOG.isErrorEnabled()) { LOG.error( Messages.get().getBundle().key(Messages.ERR_PROCESS_TAG_1, "elementSetting"), ex); } throw new javax.servlet.jsp.JspException(ex); } } return SKIP_BODY; }