1 18 package org.apache.roller.ui.core.tags; 19 20 import org.apache.commons.logging.Log; 21 import org.apache.commons.logging.LogFactory; 22 import org.apache.roller.ui.core.RollerSession; 23 24 import java.io.IOException ; 25 26 import javax.servlet.http.HttpServletRequest ; 27 import javax.servlet.jsp.JspException ; 28 import javax.servlet.jsp.JspWriter ; 29 import javax.servlet.jsp.tagext.Tag ; 30 import javax.servlet.jsp.tagext.TagSupport ; 31 32 33 37 public class StatusMessageTag extends TagSupport 38 { 39 static final long serialVersionUID = -1086963203859216226L; 40 41 private static Log mLogger = 42 LogFactory.getFactory().getInstance(StatusMessageTag.class); 43 44 public int doStartTag() throws JspException 45 { 46 try 47 { 48 JspWriter pw = pageContext.getOut(); 49 HttpServletRequest req = 50 (HttpServletRequest )pageContext.getRequest(); 51 52 String msg = null; 53 54 msg = (String )req.getSession().getAttribute( 55 RollerSession.ERROR_MESSAGE); 56 if (msg != null) 57 { 58 pw.println("<span class=\"error\">"); 59 pw.println(msg); 60 pw.println("</span>"); 61 req.getSession().removeAttribute(RollerSession.ERROR_MESSAGE); 62 } 63 64 msg = (String )req.getSession().getAttribute( 65 RollerSession.STATUS_MESSAGE); 66 if (msg != null) 67 { 68 pw.println("<span class=\"statusMsg\">"); 69 pw.println(msg); 70 pw.println("</span>"); 71 req.getSession().removeAttribute(RollerSession.STATUS_MESSAGE); 72 } 73 } 74 catch (IOException e) 75 { 76 mLogger.error("Exception",e); 77 throw new JspException (e); 78 } 79 return Tag.SKIP_BODY; 80 } 81 } 82 83 | Popular Tags |