//File: index.html
<HTML>
    <HEAD>
        <TITLE>Submitting Multiple Selection Select Controls</TITLE>
    </HEAD>
 
    <BODY>
        <H1>Submitting Multiple Selection Select Controls<H1>
        <FORM ACTION="formAction.jsp" METHOD="POST">
            <SELECT NAME="select1" SIZE="5" MULTIPLE>
                <OPTION>Option 1</OPTION>
                <OPTION SELECTED>Option 2</OPTION>
                <OPTION>Option 3</OPTION>
                <OPTION>Option 4</OPTION>
                <OPTION>Option 5</OPTION>
           </SELECT>
           <BR>
           <INPUT TYPE="SUBMIT" VALUE="Submit">
       </FORM>
    </BODY>
</HTML>

//File: formAction.jsp
<HTML>
    <HEAD>
        <TITLE>Reading Multiple Selection Select Controls</TITLE>
    </HEAD>

<BODY>
        <H1>Reading Multiple Selection Select Controls</H1>
        You selected:
        <BR>
        <% String[] items = request.getParameterValues("select1");
        for(int loopIndex = 0; loopIndex < items.length; loopIndex++){
            out.println(items[loopIndex] + "<BR>");
        }
        %>
    </BODY>
</HTML>

注意select1中必须有选中的项,否则不会传递到新的jsp页面。

REF:

http://www.devmanuals.com/tutorials/java/jsp/multipleSelectOption.html

http://www.java2s.com/Code/Java/JSP/SubmittingMultipleSelectionSelectControls.htm

http://stackoverflow.com/questions/2407945/how-to-get-multiple-selected-values-from-select-box-in-jsp

http://www.xue163.com/165/6/1654775.html

http://blog.csdn.net/overmind/article/details/670109

jsp select multiple的更多相关文章

  1. Select multiple多选上移、下移

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD ...

  2. How to select Multiple images from UIImagePickerController [duplicate]

    accepted You have to use custom imagepicker. And I think ELCImagePickerController is the best option ...

  3. select multiple images in Android Gallery

    http://stackoverflow.com/questions/18520976/all-properties-of-intent-putextra-to-crop-image-in-andro ...

  4. <select multiple="multiple"> 数据回显

    var names = yunying_name.split(","); for (var i = 0; i < names.length; i++) { names[i] ...

  5. <select>设置multiple="multiple"属性后 下拉框全部展开了 不再是折叠的怎么回事

    1 <select multiple="multiple" size="5"> <option>1</option> < ...

  6. 网页播放器(jsp、js)

    jsp对控件显示 <%@ page language="java" import="java.util.*" pageEncoding="UTF ...

  7. Oracle Applications Multiple Organizations Access Control for Custom Code

    档 ID 420787.1 White Paper Oracle Applications Multiple Organizations Access Control for Custom Code ...

  8. jQuery在html有效,在jsp无效的原因

    最近用jQuery来写下拉框的选项值的左右移动,代码如下: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN& ...

  9. 左右两个Select列表框交换数据的JS

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD ...

随机推荐

  1. mysql数据库如何设置表名大小写不敏感?

    转自:https://blog.csdn.net/iefreer/article/details/8313839 在跨平台的程序设计中要注意到mysql的一些系统变量在windows和linux上的缺 ...

  2. maven2报xxxServlet cannot be cast to javax.servlet

    由于CacheFilter实现了javax.servlet.Filter接口,Filter是在servlet-api.jar里,因此pom中有  <dependency>          ...

  3. Get请求-Test版

    package com.fanqi.test; import java.io.DataInputStream; import java.io.IOException; import java.io.I ...

  4. 通过脚本同时运行几个spider

    # 通过脚本同时运行几个spider目录结构: 1.在命令行能通过的情况下创建两个spider如TestSpiderTest2Spider 2.在items.py的同级目录创建run.py文件,有三种 ...

  5. mysqldump迁移说明

    使用mysqldump导出数据, 数据包含单行insert,带字段值 #使用mysqldump备份数据到文件, 主要在每个分片的主上面进行备份,确保数据是最新的. mysqldump -h192. - ...

  6. jquery实现滚动到页面底部时无限加载内容的代码

    var p="{$other.p}"; if(p=="") p=1; var stop=true;//触发开关,防止多次调用事件 $(window).scrol ...

  7. ios 画图总结

    0 CGContextRef context = UIGraphicsGetCurrentContext(); 设置上下文1 CGContextMoveToPoint 开始画线2 CGContextA ...

  8. 全面解析JavaScript中“&&”和“||”操作符(总结篇)

    1.||(逻辑或), 从字面上来说,只有前后都是false的时候才返回false,否则返回true. ? 1 2 3 4 alert(true||false); // true alert(false ...

  9. 接口测试工具 — jmeter(参数化)

    1.用户定义的变量 添加一个用户定义的变量 添加变量值 2.函数生成器 函数生成 随机数生成 取当前时间 3.从文件中读取 1)新建一个TXT文档,录入数据 2)读取文件 3)使用数据,用 ${pho ...

  10. shell function/for in/for (())/string concat/has dir/rename using regex/if(())/exit/execute command and pass value to variable/execute python

    #!/bin/bash #remove the MER.*_ in file name for all the files in a dir function getdir(){ for elemen ...