View | Details | Raw Unified | Return to bug 25497
Collapse All | Expand All

(-)CheckBox.orig (-25 / +25 lines)
Lines 3-9 Link Here
3
 *
3
 *
4
 * The Apache Software License, Version 1.1
4
 * The Apache Software License, Version 1.1
5
 *
5
 *
6
 * Copyright (c) 1999 The Apache Software Foundation.  All rights 
6
 * Copyright (c) 1999 The Apache Software Foundation.  All rights
7
 * reserved.
7
 * reserved.
8
 *
8
 *
9
 * Redistribution and use in source and binary forms, with or without
9
 * Redistribution and use in source and binary forms, with or without
Lines 11-17 Link Here
11
 * are met:
11
 * are met:
12
 *
12
 *
13
 * 1. Redistributions of source code must retain the above copyright
13
 * 1. Redistributions of source code must retain the above copyright
14
 *    notice, this list of conditions and the following disclaimer. 
14
 *    notice, this list of conditions and the following disclaimer.
15
 *
15
 *
16
 * 2. Redistributions in binary form must reproduce the above copyright
16
 * 2. Redistributions in binary form must reproduce the above copyright
17
 *    notice, this list of conditions and the following disclaimer in
17
 *    notice, this list of conditions and the following disclaimer in
Lines 19-33 Link Here
19
 *    distribution.
19
 *    distribution.
20
 *
20
 *
21
 * 3. The end-user documentation included with the redistribution, if
21
 * 3. The end-user documentation included with the redistribution, if
22
 *    any, must include the following acknowlegement:  
22
 *    any, must include the following acknowlegement:
23
 *       "This product includes software developed by the 
23
 *       "This product includes software developed by the
24
 *        Apache Software Foundation (http://www.apache.org/)."
24
 *        Apache Software Foundation (http://www.apache.org/)."
25
 *    Alternately, this acknowlegement may appear in the software itself,
25
 *    Alternately, this acknowlegement may appear in the software itself,
26
 *    if and wherever such third-party acknowlegements normally appear.
26
 *    if and wherever such third-party acknowlegements normally appear.
27
 *
27
 *
28
 * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
28
 * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
29
 *    Foundation" must not be used to endorse or promote products derived
29
 *    Foundation" must not be used to endorse or promote products derived
30
 *    from this software without prior written permission. For written 
30
 *    from this software without prior written permission. For written
31
 *    permission, please contact apache@apache.org.
31
 *    permission, please contact apache@apache.org.
32
 *
32
 *
33
 * 5. Products derived from this software may not be called "Apache"
33
 * 5. Products derived from this software may not be called "Apache"
Lines 53-59 Link Here
53
 * information on the Apache Software Foundation, please see
53
 * information on the Apache Software Foundation, please see
54
 * <http://www.apache.org/>.
54
 * <http://www.apache.org/>.
55
 *
55
 *
56
 */ 
56
 */
57
package org.apache.taglibs.input;
57
package org.apache.taglibs.input;
58
58
59
import java.util.*;
59
import java.util.*;
Lines 63-69 Link Here
63
63
64
/**
64
/**
65
 *
65
 *
66
 *  This class implements the &lt;input:checkbox&gt; tag, which presents an 
66
 *  This class implements the &lt;input:checkbox&gt; tag, which presents an
67
 *  &lt;input type="checkbox" ... /&gt; form element.
67
 *  &lt;input type="checkbox" ... /&gt; form element.
68
 *
68
 *
69
 *  @version 0.90
69
 *  @version 0.90
Lines 133-139 Link Here
133
             * selections.  (No need for a hash table as in <select> because
133
             * selections.  (No need for a hash table as in <select> because
134
             * we're doing this exactly once per tag.  We COULD cache stuff
134
             * we're doing this exactly once per tag.  We COULD cache stuff
135
             * between tags, but I'm not sure that kind of extra performance
135
             * between tags, but I'm not sure that kind of extra performance
136
             * would ever be called for.) 
136
             * would ever be called for.)
137
             * We first check if there is a bean value associated with the checkbox, if
137
             * We first check if there is a bean value associated with the checkbox, if
138
             * there is we use it.
138
             * there is we use it.
139
             * Then note that we only use the
139
             * Then note that we only use the
Lines 146-152 Link Here
146
             * as the initial value of the property in the bean when it is constructed
146
             * as the initial value of the property in the bean when it is constructed
147
             * rather than using the "default" attribute of the checkbox tag.
147
             * rather than using the "default" attribute of the checkbox tag.
148
             */
148
             */
149
            
149
150
            // First check beanValue, if available - then we don't worry about
150
            // First check beanValue, if available - then we don't worry about
151
            // the defaults or request values etc
151
            // the defaults or request values etc
152
            String [] beanValues = ( beanId != null ? Util.beanPropertyValues(
152
            String [] beanValues = ( beanId != null ? Util.beanPropertyValues(
Lines 154-160 Link Here
154
            if ( beanValues != null ) {
154
            if ( beanValues != null ) {
155
                for ( int i = 0; i < beanValues.length; i++ ) {
155
                for ( int i = 0; i < beanValues.length; i++ ) {
156
                    if ( beanValues[i] != null && beanValues[i].equals( value ) ) {
156
                    if ( beanValues[i] != null && beanValues[i].equals( value ) ) {
157
                        out.print("checked=\"true\" ");
157
                        out.print("checked=\"checked\" ");
158
                        break;
158
                        break;
159
                    }
159
                    }
160
                }
160
                }
Lines 170-176 Link Here
170
                              "'default' array must only contain non-null "
170
                              "'default' array must only contain non-null "
171
                              + "Strings");
171
                              + "Strings");
172
                        if ((dVals.get(i)).equals(value)) {
172
                        if ((dVals.get(i)).equals(value)) {
173
                            out.print("checked=\"true\" ");
173
                            out.print("checked=\"checked\" ");
174
                            break;              // why go on?
174
                            break;              // why go on?
175
                        }
175
                        }
176
                    }
176
                    }
Lines 183-195 Link Here
183
                    // use the request if it says anything
183
                    // use the request if it says anything
184
                    for (int i = 0; i < checked.length; i++) {
184
                    for (int i = 0; i < checked.length; i++) {
185
                        if (checked[i].equals(value)) {
185
                        if (checked[i].equals(value)) {
186
                            out.print("checked=\"true\" ");
186
                            out.print("checked=\"checked\" ");
187
                            break;                  // why go on?
187
                            break;                  // why go on?
188
                        }
188
                        }
189
                    }
189
                    }
190
                }
190
                }
191
            }
191
            }
192
        
192
193
            // end the tag
193
            // end the tag
194
            out.print("/>");
194
            out.print("/>");
195
195
Lines 198-222 Link Here
198
        }
198
        }
199
        return SKIP_BODY;
199
        return SKIP_BODY;
200
    }
200
    }
201
    
201
202
    /** Getter for property name.
202
    /** Getter for property name.
203
     * @return Value of property name.
203
     * @return Value of property name.
204
     */
204
     */
205
    public String getName() { return name; }
205
    public String getName() { return name; }
206
    
206
207
    public void setName(String x) {
207
    public void setName(String x) {
208
        name = x;
208
        name = x;
209
    }
209
    }
210
    
210
211
    /** Getter for property value.
211
    /** Getter for property value.
212
     * @return Value of property value.
212
     * @return Value of property value.
213
     */
213
     */
214
    public String getValue() { return value; }
214
    public String getValue() { return value; }
215
    
215
216
    public void setValue(String x) {
216
    public void setValue(String x) {
217
        value = x;
217
        value = x;
218
    }
218
    }
219
    
219
220
    /** Getter for property defaults.
220
    /** Getter for property defaults.
221
     * @return Value of property defaults.
221
     * @return Value of property defaults.
222
     */
222
     */
Lines 225-231 Link Here
225
    public void setDefaults(String[] x) {
225
    public void setDefaults(String[] x) {
226
	dValArray = x;
226
	dValArray = x;
227
    }
227
    }
228
    
228
229
    /** Getter for property default.
229
    /** Getter for property default.
230
     * @return Value of property default.
230
     * @return Value of property default.
231
     */
231
     */
Lines 234-258 Link Here
234
    public void setDefault(String x) {
234
    public void setDefault(String x) {
235
        dVal = x;
235
        dVal = x;
236
    }
236
    }
237
    
237
238
    /** Getter for property bean.
238
    /** Getter for property bean.
239
     * @return Value of property bean.
239
     * @return Value of property bean.
240
     */
240
     */
241
    public String getBean() { return beanId; }
241
    public String getBean() { return beanId; }
242
    
242
243
    public void setBean( String x ) {
243
    public void setBean( String x ) {
244
        beanId = x;
244
        beanId = x;
245
    }
245
    }
246
    
246
247
    /** Getter for property attributesText.
247
    /** Getter for property attributesText.
248
     * @return Value of property attributesText.
248
     * @return Value of property attributesText.
249
     */
249
     */
250
    public String getAttributesText() { return attributesText; }
250
    public String getAttributesText() { return attributesText; }
251
    
251
252
    public void setAttributesText( String x ) {
252
    public void setAttributesText( String x ) {
253
        attributesText = x;
253
        attributesText = x;
254
    }
254
    }
255
    
255
256
    /** Getter for property attributes.
256
    /** Getter for property attributes.
257
     * @return Value of property attributes.
257
     * @return Value of property attributes.
258
     */
258
     */
Lines 261-265 Link Here
261
    public void setAttributes(Map x) {
261
    public void setAttributes(Map x) {
262
        attributes = x;
262
        attributes = x;
263
    }
263
    }
264
    
264
265
}
265
}
(-)Checkbox.java (-3 / +3 lines)
Lines 154-160 Link Here
154
            if ( beanValues != null ) {
154
            if ( beanValues != null ) {
155
                for ( int i = 0; i < beanValues.length; i++ ) {
155
                for ( int i = 0; i < beanValues.length; i++ ) {
156
                    if ( beanValues[i] != null && beanValues[i].equals( value ) ) {
156
                    if ( beanValues[i] != null && beanValues[i].equals( value ) ) {
157
                        out.print("checked=\"checked\" ");
157
                        out.print("checked=\"true\" ");
158
                        break;
158
                        break;
159
                    }
159
                    }
160
                }
160
                }
Lines 170-176 Link Here
170
                              "'default' array must only contain non-null "
170
                              "'default' array must only contain non-null "
171
                              + "Strings");
171
                              + "Strings");
172
                        if ((dVals.get(i)).equals(value)) {
172
                        if ((dVals.get(i)).equals(value)) {
173
                            out.print("checked=\"checked\" ");
173
                            out.print("checked=\"true\" ");
174
                            break;              // why go on?
174
                            break;              // why go on?
175
                        }
175
                        }
176
                    }
176
                    }
Lines 183-189 Link Here
183
                    // use the request if it says anything
183
                    // use the request if it says anything
184
                    for (int i = 0; i < checked.length; i++) {
184
                    for (int i = 0; i < checked.length; i++) {
185
                        if (checked[i].equals(value)) {
185
                        if (checked[i].equals(value)) {
186
                            out.print("checked=\"checked\" ");
186
                            out.print("checked=\"true\" ");
187
                            break;                  // why go on?
187
                            break;                  // why go on?
188
                        }
188
                        }
189
                    }
189
                    }
(-)Checkbox.orig (-3 / +3 lines)
Lines 154-160 Link Here
154
            if ( beanValues != null ) {
154
            if ( beanValues != null ) {
155
                for ( int i = 0; i < beanValues.length; i++ ) {
155
                for ( int i = 0; i < beanValues.length; i++ ) {
156
                    if ( beanValues[i] != null && beanValues[i].equals( value ) ) {
156
                    if ( beanValues[i] != null && beanValues[i].equals( value ) ) {
157
                        out.print("checked=\"true\" ");
157
                        out.print("checked=\"checked\" ");
158
                        break;
158
                        break;
159
                    }
159
                    }
160
                }
160
                }
Lines 170-176 Link Here
170
                              "'default' array must only contain non-null "
170
                              "'default' array must only contain non-null "
171
                              + "Strings");
171
                              + "Strings");
172
                        if ((dVals.get(i)).equals(value)) {
172
                        if ((dVals.get(i)).equals(value)) {
173
                            out.print("checked=\"true\" ");
173
                            out.print("checked=\"checked\" ");
174
                            break;              // why go on?
174
                            break;              // why go on?
175
                        }
175
                        }
176
                    }
176
                    }
Lines 183-189 Link Here
183
                    // use the request if it says anything
183
                    // use the request if it says anything
184
                    for (int i = 0; i < checked.length; i++) {
184
                    for (int i = 0; i < checked.length; i++) {
185
                        if (checked[i].equals(value)) {
185
                        if (checked[i].equals(value)) {
186
                            out.print("checked=\"true\" ");
186
                            out.print("checked=\"checked\" ");
187
                            break;                  // why go on?
187
                            break;                  // why go on?
188
                        }
188
                        }
189
                    }
189
                    }

Return to bug 25497