Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 1 | <html><body><pre>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 2 | <%--
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 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.
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 17 | --%>
|
| 18 | <html>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 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>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 27 | <%
|
| 28 | fruits = request.getParameterValues("fruit");
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 29 | %>
|
| 30 | <ul>
|
| 31 | <%
|
| 32 | if (fruits != null) {
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 33 | for (int i = 0; i < fruits.length; i++) {
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 34 | %>
|
| 35 | <li>
|
| 36 | <%
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 37 | out.println (util.HTMLFilter.filter(fruits[i]));
|
| 38 | }
|
| 39 | } else out.println ("none selected");
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 40 | %>
|
| 41 | </ul>
|
| 42 | <br>
|
| 43 | <hr>
|
| 44 |
|
| 45 | The checked fruits (got using beans) are <br>
|
| 46 |
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 47 | <%
|
| 48 | fruits = foo.getFruit();
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 49 | %>
|
| 50 | <ul>
|
| 51 | <%
|
| 52 | if (!fruits[0].equals("1")) {
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 53 | for (int i = 0; i < fruits.length; i++) {
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 54 | %>
|
| 55 | <li>
|
| 56 | <%
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 57 | out.println (util.HTMLFilter.filter(fruits[i]));
|
| 58 | }
|
| 59 | } else out.println ("none selected");
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 60 | %>
|
| 61 | </ul>
|
| 62 | </font>
|
| 63 | </body>
|
| 64 | </html>
|
| 65 | </pre></body></html>
|