40荤! 关于jsp 查询语句中获得得复选框里的值的问题
先是一个 changes.jsp 的关键代码,他的目的是实现复选框里的多值
<%
String bookType[]={ "dk ", "sk ", "gk ", "nk "};
int number=bookType.length;
%>
<body background= "beijing.gif "> <div align= "center ">
获取复选框的值
<form name= "form " method= "post " action= "changes_result.jsp " onSubmit= "return checkEmpty(form) ">
<table width= "276 ">
<tr>
<td width= "266 "> 选择渠道 </td>
</tr>
<%
for(int i=0;i <bookType.length;i++){
%>
<tr>
<td> <input type= "checkbox " name= "name <%=i%> " value= " <%=bookType[i]%> ">
<%=bookType[i]%> </td>
</tr>
<%}%>
</table>
<input type= "hidden " name= "number " value= " <%=bookType.length%> ">
<input type= "submit " name= "Submit " value= "提交 ">
查询得到结果 change_result.jsp 的关键代码:
<%
request.setCharacterEncoding( "gb2312 ");
int number=Integer.parseInt(request.getParameter( "number "));
%>
<%
for(int i=0;i <number;i++){
String name= "name "+i;
if(request.getParameter(name)!=null){
%>
<tr>
<td width= "226 "> <div align= "center <%=request.getParameter(name)%> </div> </td>
</tr>
<%}}%>
可以看到直接使用 <%=request.getParameter(name)%> 就可以得到复选框里的值
但是,如果直接使用下面的,就是无法获得name 的值啊
<% }} catch(Exception ex) {}%>
<%
try{
String sql= "select * from serv6 where cust_gp in ( ' "+request.getParameter( "name ")+ " ') ";
ResultSet rs=connection.executeQuery(sql);
while(rs.next()){
%>
所以,现在问题是,上面这段代码,该如何改,使得其可以得到name的值得呢?
哪个大大知道的 ,40分送上!
------解决方案--------------------.
.
<tr>
&