| 1 | <html> | 
|---|
| 2 | <!-- | 
|---|
| 3 | Licensed to the Apache Software Foundation (ASF) under one or more | 
|---|
| 4 | contributor license agreements.  See the NOTICE file distributed with | 
|---|
| 5 | this work for additional information regarding copyright ownership. | 
|---|
| 6 | The ASF licenses this file to You under the Apache License, Version 2.0 | 
|---|
| 7 | (the "License"); you may not use this file except in compliance with | 
|---|
| 8 | the License.  You may obtain a copy of the License at | 
|---|
| 9 |  | 
|---|
| 10 | http://www.apache.org/licenses/LICENSE-2.0 | 
|---|
| 11 |  | 
|---|
| 12 | Unless required by applicable law or agreed to in writing, software | 
|---|
| 13 | distributed under the License is distributed on an "AS IS" BASIS, | 
|---|
| 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
|---|
| 15 | See the License for the specific language governing permissions and | 
|---|
| 16 | limitations under the License. | 
|---|
| 17 | --> | 
|---|
| 18 |  | 
|---|
| 19 | <body bgcolor="white"> | 
|---|
| 20 | <font size=5 color="red"> | 
|---|
| 21 | <%! String[] fruits; %> | 
|---|
| 22 | <jsp:useBean id="foo" scope="page" class="checkbox.CheckTest" /> | 
|---|
| 23 |  | 
|---|
| 24 | <jsp:setProperty name="foo" property="fruit" param="fruit" /> | 
|---|
| 25 | <hr> | 
|---|
| 26 | The checked fruits (got using request) are: <br> | 
|---|
| 27 | <% | 
|---|
| 28 | fruits = request.getParameterValues("fruit"); | 
|---|
| 29 | %> | 
|---|
| 30 | <ul> | 
|---|
| 31 | <% | 
|---|
| 32 | if (fruits != null) { | 
|---|
| 33 | for (int i = 0; i < fruits.length; i++) { | 
|---|
| 34 | %> | 
|---|
| 35 | <li> | 
|---|
| 36 | <% | 
|---|
| 37 | out.println (util.HTMLFilter.filter(fruits[i])); | 
|---|
| 38 | } | 
|---|
| 39 | } else out.println ("none selected"); | 
|---|
| 40 | %> | 
|---|
| 41 | </ul> | 
|---|
| 42 | <br> | 
|---|
| 43 | <hr> | 
|---|
| 44 |  | 
|---|
| 45 | The checked fruits (got using beans) are <br> | 
|---|
| 46 |  | 
|---|
| 47 | <% | 
|---|
| 48 | fruits = foo.getFruit(); | 
|---|
| 49 | %> | 
|---|
| 50 | <ul> | 
|---|
| 51 | <% | 
|---|
| 52 | if (!fruits[0].equals("1")) { | 
|---|
| 53 | for (int i = 0; i < fruits.length; i++) { | 
|---|
| 54 | %> | 
|---|
| 55 | <li> | 
|---|
| 56 | <% | 
|---|
| 57 | out.println (util.HTMLFilter.filter(fruits[i])); | 
|---|
| 58 | } | 
|---|
| 59 | } else out.println ("none selected"); | 
|---|
| 60 | %> | 
|---|
| 61 | </ul> | 
|---|
| 62 | </font> | 
|---|
| 63 | </body> | 
|---|
| 64 | </html> | 
|---|