1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 package org.talika.tarsis.taglib.form;
24
25 /**
26 * Implementation of input type radio form control tag.
27 *
28 * @author Jose M. Palomar
29 * @version $Revision: 130 $
30 */
31 public final class RadioTag extends InputTag {
32
33
34 /**
35 * <code>checked</code> attribute.
36 */
37 private boolean checked;
38
39
40 /**
41 * Creates a new <code>RadioTag</code> object.
42 */
43 public RadioTag() {
44 super("radio");
45 }
46
47
48 /**
49 * Renders a string with values of input attributes.<br>
50 * Input attribute for radio is <code>checked</code>.
51 *
52 * @return String a string with values of input attributes.
53 */
54 public String inputAttributes() {
55
56 StringBuffer atts = new StringBuffer();
57
58 if (checked) {
59 atts.append(" checked");
60 }
61
62 return atts.toString();
63
64 }
65
66
67 /**
68 * Sets <code>checked</code> attribute value.
69 *
70 * @param checked String <code>checked</code> attribute value.
71 */
72 public void setChecked(String checked) {
73 this.checked = checked.equals("true");
74 }
75
76 /**
77 * Called on a Tag handler to release state.
78 *
79 * @see javax.servlet.jsp.tagext.Tag#release()
80 */
81 public void release() {
82
83 super.release();
84
85 this.checked = false;
86
87 }
88
89 }