1 64 65 package com.jcorporate.expresso.ext.taglib; 66 67 import com.jcorporate.expresso.core.misc.CurrentLogin; 68 69 import javax.servlet.jsp.JspTagException ; 70 import javax.servlet.jsp.JspWriter ; 71 import javax.servlet.jsp.PageContext ; 72 import java.io.IOException ; 73 74 75 78 public class UserName 79 extends ExpressoTagSupport { 80 public UserName() { 81 super(); 82 } 83 84 public int doEndTag() 85 throws javax.servlet.jsp.JspTagException { 86 CurrentLogin cl = (CurrentLogin) pageContext.getAttribute(CurrentLogin.LOGIN_KEY, 87 PageContext.SESSION_SCOPE); 88 JspWriter writer = pageContext.getOut(); 89 90 try { 91 if (cl == null) { 92 writer.println("Not Logged In"); 93 } else { 94 writer.println(cl.getUserName()); 95 } 96 } catch (IOException ioe) { 97 throw new JspTagException ("UserName Tag Error: " + 98 ioe.getMessage()); 99 } 100 101 return EVAL_PAGE; 102 } 103 } 104 105 | Popular Tags |