1 16 17 package org.apache.tester; 18 19 20 import java.io.Serializable ; 21 import java.sql.Date ; 22 import javax.servlet.http.HttpSessionActivationListener ; 23 import javax.servlet.http.HttpSessionBindingEvent ; 24 import javax.servlet.http.HttpSessionBindingListener ; 25 import javax.servlet.http.HttpSessionEvent ; 26 27 28 35 36 public class SessionBean implements 37 HttpSessionActivationListener , HttpSessionBindingListener , Serializable { 38 39 40 42 43 46 protected Date dateProperty = 47 new Date (System.currentTimeMillis()); 48 49 public Date getDateProperty() { 50 return (this.dateProperty); 51 } 52 53 public void setDateProperty(Date dateProperty) { 54 this.dateProperty = dateProperty; 55 } 56 57 58 61 protected String lifecycle = ""; 62 63 public String getLifecycle() { 64 return (this.lifecycle); 65 } 66 67 public void setLifecycle(String lifecycle) { 68 this.lifecycle = lifecycle; 69 } 70 71 72 75 protected String stringProperty = "Default String Property Value"; 76 77 public String getStringProperty() { 78 return (this.stringProperty); 79 } 80 81 public void setStringProperty(String stringProperty) { 82 this.stringProperty = stringProperty; 83 } 84 85 86 88 89 92 public String toString() { 93 94 StringBuffer sb = new StringBuffer ("SessionBean[lifecycle="); 95 sb.append(this.lifecycle); 96 sb.append(",dateProperty="); 97 sb.append(dateProperty); 98 sb.append(",stringProperty="); 99 sb.append(this.stringProperty); 100 sb.append("]"); 101 return (sb.toString()); 102 103 } 104 105 106 108 109 114 public void sessionDidActivate(HttpSessionEvent event) { 115 116 lifecycle += "/sda"; 117 118 } 119 120 121 126 public void sessionWillPassivate(HttpSessionEvent event) { 127 128 lifecycle += "/swp"; 129 130 } 131 132 133 135 136 141 public void valueBound(HttpSessionBindingEvent event) { 142 143 lifecycle += "/vb"; 144 145 } 146 147 148 153 public void valueUnbound(HttpSessionBindingEvent event) { 154 155 lifecycle += "/vu"; 156 157 } 158 159 160 } 161 162 | Popular Tags |