---
title: "批量checkbox提交问题"
author: "mousepc"
date: "2011-10-07T01:48:38Z"
tags: []
categories: ["编程语言"]
slug: "checkbox"
draft: false
lastmod: "2011-10-07T01:48:38Z"
id: 1186131
url: "https://mousepc.iteye.com/blog/1186131"
---

&lt;form method="post" action="result.jsp" target="\_blank"&gt;

&lt;input type=checkbox name=interest value="篮球"&gt;

        篮球&lt;p&gt;

&lt;input type=checkbox name=interest value=" 游泳"&gt;

        游泳&lt;p&gt;

&lt;input type=checkbox name=interest value="读书"&gt;

        读书&lt;p&gt;

&lt;input type="submit" value="提交"&gt;

&lt;/form&gt;

上面这些checkbox的name是一样的，我们可以一样提交他们。在接收端之需要:

String s\[] = request.getParameterValues("interest");

for (int i = 0; i &lt; s.length; i++)

{

out.print(s\[i] + "&lt;br&gt;");

}

这样接收就可以了。