1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| |
8 |
| |
9 |
| |
10 |
| |
11 |
| |
12 |
| |
13 |
| |
14 |
| |
15 |
| |
16 |
| package cal; |
17 |
| |
18 |
| import java.beans.*; |
19 |
| import javax.servlet.http.*; |
20 |
| import javax.servlet.*; |
21 |
| import java.util.Hashtable; |
22 |
| |
23 |
| public class TableBean { |
24 |
| |
25 |
| Hashtable table; |
26 |
| JspCalendar JspCal; |
27 |
| Entries entries; |
28 |
| String date; |
29 |
| String name = null; |
30 |
| String email = null; |
31 |
| boolean processError = false; |
32 |
| |
33 |
0
| public TableBean () {
|
34 |
0
| this.table = new Hashtable (10);
|
35 |
0
| this.JspCal = new JspCalendar ();
|
36 |
0
| this.date = JspCal.getCurrentDate ();
|
37 |
| } |
38 |
| |
39 |
0
| public void setName (String nm) {
|
40 |
0
| this.name = nm;
|
41 |
| } |
42 |
| |
43 |
0
| public String getName () {
|
44 |
0
| return this.name;
|
45 |
| } |
46 |
| |
47 |
0
| public void setEmail (String mail) {
|
48 |
0
| this.email = mail;
|
49 |
| } |
50 |
| |
51 |
0
| public String getEmail () {
|
52 |
0
| return this.email;
|
53 |
| } |
54 |
| |
55 |
0
| public String getDate () {
|
56 |
0
| return this.date;
|
57 |
| } |
58 |
| |
59 |
0
| public Entries getEntries () {
|
60 |
0
| return this.entries;
|
61 |
| } |
62 |
| |
63 |
0
| public void processRequest (HttpServletRequest request) {
|
64 |
| |
65 |
| |
66 |
0
| this.processError = false;
|
67 |
0
| if (name == null || name.equals("")) setName(request.getParameter ("name"));
|
68 |
0
| if (email == null || email.equals("")) setEmail(request.getParameter ("email"));
|
69 |
0
| if (name == null || email == null ||
|
70 |
| name.equals("") || email.equals("")) { |
71 |
0
| this.processError = true;
|
72 |
0
| return;
|
73 |
| } |
74 |
| |
75 |
| |
76 |
0
| String dateR = request.getParameter ("date");
|
77 |
0
| if (dateR == null) date = JspCal.getCurrentDate ();
|
78 |
0
| else if (dateR.equalsIgnoreCase("next")) date = JspCal.getNextDate ();
|
79 |
0
| else if (dateR.equalsIgnoreCase("prev")) date = JspCal.getPrevDate ();
|
80 |
| |
81 |
0
| entries = (Entries) table.get (date);
|
82 |
0
| if (entries == null) {
|
83 |
0
| entries = new Entries ();
|
84 |
0
| table.put (date, entries);
|
85 |
| } |
86 |
| |
87 |
| |
88 |
0
| String time = request.getParameter("time");
|
89 |
0
| if (time != null) entries.processRequest (request, time);
|
90 |
| } |
91 |
| |
92 |
0
| public boolean getProcessError () {
|
93 |
0
| return this.processError;
|
94 |
| } |
95 |
| } |
96 |
| |
97 |
| |
98 |
| |
99 |
| |
100 |
| |
101 |
| |