1 16 package dlog4j.tags; 17 18 import java.sql.SQLException ; 19 20 import javax.servlet.jsp.JspException ; 21 22 import net.sf.hibernate.HibernateException; 23 import net.sf.hibernate.Session; 24 import dlog4j.ParamManager; 25 import dlog4j.SiteManager; 26 import dlog4j.formbean.ParamForm; 27 import dlog4j.formbean.SiteForm; 28 29 33 public class ParamTag extends DlogBaseTag { 34 35 String name ; 36 String value; 37 38 41 public int doStartTag() throws JspException { 42 Session ssn = null; 43 try{ 44 ssn = getSession(); 45 SiteForm site = SiteManager.getCurrentSite(pageContext.getRequest()); 46 ParamForm param = ParamManager.getParam(ssn,site,name); 47 if(param==null){ 48 param = new ParamForm(); 49 param.setName(name); 50 param.setValue(value); 51 } 52 pageContext.setAttribute(id, param); 53 } catch (SQLException e) { 54 throw new JspException (e); 55 } catch (HibernateException e) { 56 throw new JspException (e); 57 }finally{ 58 try{ 59 closeSession(ssn); 60 }catch(Exception e){} 61 } 62 return SKIP_BODY; 63 } 64 65 68 public String getName() { 69 return name; 70 } 71 72 75 public void setName(String string) { 76 name = string; 77 } 78 79 82 public String getValue() { 83 return value; 84 } 85 86 89 public void setValue(String string) { 90 value = string; 91 } 92 93 96 public void setValue(int string) { 97 value = String.valueOf(string); 98 } 99 102 public void setValue(Integer string) { 103 value = String.valueOf(string.intValue()); 104 } 105 106 } 107 | Popular Tags |