KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > examples > app1 > AddressBean


1 /*
2  * Copyright 2003 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package examples.app1;
18
19
20 import javax.servlet.http.HttpServletRequest JavaDoc;
21 import org.apache.struts.action.ActionError;
22 import org.apache.struts.action.ActionErrors;
23 import org.apache.struts.action.ActionForm;
24 import org.apache.struts.action.ActionMapping;
25
26 import java.util.Properties JavaDoc;
27
28
29 /**
30  * <p>A simple bean that represent an address record.</p>
31  *
32  * @author <a HREF="mailto:sidler@teamup.com"/>Gabe Sidler</a>
33  * @version $Id: AddressBean.java,v 1.2 2004/02/20 12:42:47 marino Exp $
34  */

35
36 public class AddressBean extends Object JavaDoc
37 {
38
39
40     // ---- Fields ------------------------------------------------------
41
private String JavaDoc firstname;
42
43     private String JavaDoc lastname;
44
45     private String JavaDoc street;
46
47     private String JavaDoc zip;
48
49     private String JavaDoc city;
50
51     private String JavaDoc country;
52
53     private String JavaDoc[] languages;
54
55
56     // ---- Accessor Methods --------------------------------------------
57

58     public String JavaDoc getFirstname()
59     {
60         return firstname;
61
62     }
63
64     public void setFirstname(String JavaDoc s)
65     {
66         firstname = s;
67
68     }
69
70     public String JavaDoc getLastname()
71     {
72         return lastname;
73
74     }
75
76     public void setLastname(String JavaDoc s)
77     {
78         lastname = s;
79
80     }
81
82     public String JavaDoc getStreet()
83     {
84         return street;
85
86     }
87
88     public void setStreet(String JavaDoc s)
89     {
90         street = s;
91
92     }
93
94     public String JavaDoc getZip()
95     {
96         return zip;
97
98     }
99
100     public void setZip(String JavaDoc s)
101     {
102         zip = s;
103
104     }
105
106     public String JavaDoc getCity()
107     {
108         return city;
109
110     }
111
112     public void setCity(String JavaDoc s)
113     {
114         city = s;
115
116     }
117
118     public String JavaDoc getCountry()
119     {
120         return country;
121
122     }
123
124     public void setCountry(String JavaDoc s)
125     {
126         country = s;
127
128     }
129
130     public String JavaDoc[] getLanguages()
131     {
132         return languages;
133     }
134
135     public void setLanguages(String JavaDoc[] languages)
136     {
137         this.languages = languages;
138     }
139
140     // Convenience method to simplify repopulation of select lists
141
public Properties JavaDoc getLanguagesAsMap()
142     {
143         Properties JavaDoc p = new Properties JavaDoc();
144         if (languages != null)
145         {
146             for (int i = 0; i < languages.length; i++)
147                 p.setProperty((String JavaDoc)languages[i], "SELECTED");
148         }
149         return p;
150     }
151
152 }
153
154
155
156
157
Popular Tags