1 31 32 package org.opencms.jsp; 33 34 import org.opencms.file.CmsObject; 35 import org.opencms.flex.CmsFlexController; 36 import org.opencms.i18n.CmsMessages; 37 import org.opencms.main.CmsLog; 38 import org.opencms.main.OpenCms; 39 40 import javax.servlet.ServletRequest ; 41 import javax.servlet.jsp.JspException ; 42 import javax.servlet.jsp.tagext.BodyContent ; 43 import javax.servlet.jsp.tagext.BodyTagSupport ; 44 45 import org.apache.commons.logging.Log; 46 47 61 public class CmsJspTagLabel extends BodyTagSupport { 62 63 64 private static final Log LOG = CmsLog.getLog(CmsJspTagLabel.class); 65 66 67 private static final long serialVersionUID = 5720473164730803034L; 68 69 76 public static String wpLabelTagAction(String label, ServletRequest req) { 77 78 CmsObject cms = CmsFlexController.getCmsObject(req); 79 CmsMessages messages = OpenCms.getWorkplaceManager().getMessages(cms.getRequestContext().getLocale()); 80 return messages.key(label); 81 } 82 83 86 public int doAfterBody() throws JspException { 87 88 ServletRequest req = pageContext.getRequest(); 89 90 if (CmsFlexController.isCmsRequest(req)) { 92 try { 93 94 BodyContent body = this.getBodyContent(); 96 String label = body.getString(); 97 body.clearBody(); 98 99 String result = wpLabelTagAction(label, req); 101 this.getPreviousOut().print(result); 102 103 } catch (Exception ex) { 104 if (LOG.isErrorEnabled()) { 105 LOG.error(Messages.get().getBundle().key(Messages.ERR_PROCESS_TAG_1, "label"), ex); 106 } 107 throw new javax.servlet.jsp.JspException (ex); 108 } 109 } 110 return SKIP_BODY; 111 } 112 113 } 114 | Popular Tags |