1 64 65 package com.jcorporate.expresso.ext.taglib; 66 67 72 73 import com.jcorporate.expresso.core.misc.ConfigManager; 74 import com.jcorporate.expresso.core.misc.ConfigurationException; 75 import com.jcorporate.expresso.core.misc.CurrentLogin; 76 77 import javax.servlet.jsp.JspTagException ; 78 import javax.servlet.jsp.JspWriter ; 79 import javax.servlet.jsp.PageContext ; 80 import java.io.IOException ; 81 82 83 86 public class DBDescription 87 extends ExpressoTagSupport { 88 public DBDescription() { 89 super(); 90 } 91 92 93 public int doEndTag() 94 throws javax.servlet.jsp.JspTagException { 95 CurrentLogin cl = (CurrentLogin) pageContext.getAttribute(CurrentLogin.LOGIN_KEY, 96 PageContext.SESSION_SCOPE); 97 String dbName = null; 98 String dbDesc = ""; 99 100 try { 101 if (cl == null) { 102 dbName = "default"; 103 } else { 104 dbName = cl.getDBName(); 105 } 106 107 dbDesc = ConfigManager.getContext(dbName).getDescription(); 108 } catch (ConfigurationException ce) { 109 throw new JspTagException ("Configuration exception:" + 110 ce.getMessage()); 111 } 112 if ((dbDesc == null) || (dbDesc.equals(""))) { 113 dbDesc = dbName; 114 } 115 116 JspWriter out = pageContext.getOut(); 117 118 try { 119 out.println(dbDesc); 120 } catch (IOException ioe) { 121 throw new JspTagException ("DBDescription Tag Error: " + 122 ioe.getMessage()); 123 } 124 125 return EVAL_PAGE; 126 } 127 } 128 129 | Popular Tags |