日期:2014-05-18  浏览次数:20613 次

有关select的问题!(多选显示)
选择页面:
<!DOCTYPE   html   PUBLIC   "-//W3C//DTD   HTML   4.01   Transitional//EN "   "http://www.w3.org/TR/html4/loose.dtd ">
<html>
<head>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=GBK ">
<title> Insert   title   here </title>
</head>
<body>
<form   action= "resultshow.jsp "   method= "post "   name= "form1 ">
<center>
<select   name= "like "   size= "2 "   multiple= "multiple "   >
<option   selected   value= "篮球 "> 篮球
<option   value= "足球 "> 足球
<option   value= "游泳 "> 游泳
<option   value= "登山 "> 登山
<option   value= "下棋 "> 下棋
<option   value= "上网 "> 上网
</select> <br>
<input   type= "submit "   name= "OK "   value= "提交 ">
</center>
</form>
</body>
</html>


显示页面:
<%@   page   language= "java "   contentType= "text/html;   charset=GBK "%>
<!DOCTYPE   html   PUBLIC   "-//W3C//DTD   HTML   4.01   Transitional//EN "   "http://www.w3.org/TR/html4/loose.dtd ">
<html>
<head>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=GBK ">
<title> Insert   title   here </title>
</head>
<body>

你的个人爱好: <%=request.Form( "like ")   %>
</body>
</html>

看了多个帖子,仍然没搞定!在线等高手……

------解决方案--------------------
<% String like[]=request.getParameterValues( "like ");%>
<html>
<body>
<% for (int i=0;i <like.length;i++)%>
你的个人爱好: <%=like[i]%>
...

------解决方案--------------------

String fu[]=request.getParameterValues( "checkbox ");

for(int i=0;i <fu.length;i++)
{

<%= fu[i] %>

}