1 package org.roller.presentation.tags; 2 3 import org.apache.commons.logging.Log; 4 import org.apache.commons.logging.LogFactory; 5 import org.roller.presentation.RollerSession; 6 7 import java.io.IOException ; 8 9 import javax.servlet.http.HttpServletRequest ; 10 import javax.servlet.jsp.JspException ; 11 import javax.servlet.jsp.JspWriter ; 12 import javax.servlet.jsp.tagext.Tag ; 13 import javax.servlet.jsp.tagext.TagSupport ; 14 15 16 20 public class StatusMessageTag extends TagSupport 21 { 22 static final long serialVersionUID = -1086963203859216226L; 23 24 private static Log mLogger = 25 LogFactory.getFactory().getInstance(StatusMessageTag.class); 26 27 public int doStartTag() throws JspException 28 { 29 try 30 { 31 JspWriter pw = pageContext.getOut(); 32 HttpServletRequest req = 33 (HttpServletRequest )pageContext.getRequest(); 34 35 String msg = null; 36 37 msg = (String )req.getSession().getAttribute( 38 RollerSession.ERROR_MESSAGE); 39 if (msg != null) 40 { 41 pw.println("<span class=\"error\">"); 42 pw.println(msg); 43 pw.println("</span>"); 44 req.getSession().removeAttribute(RollerSession.ERROR_MESSAGE); 45 } 46 47 msg = (String )req.getSession().getAttribute( 48 RollerSession.STATUS_MESSAGE); 49 if (msg != null) 50 { 51 pw.println("<span class=\"statusMsg\">"); 52 pw.println(msg); 53 pw.println("</span>"); 54 req.getSession().removeAttribute(RollerSession.STATUS_MESSAGE); 55 } 56 } 57 catch (IOException e) 58 { 59 mLogger.error("Exception",e); 60 throw new JspException (e); 61 } 62 return Tag.SKIP_BODY; 63 } 64 } 65 66 | Popular Tags |