我不知道要向数据库插入多个复选框,它只取第一个复选框的第一个值。
String SCIENTIFIC_INTRESTS = request.getParameter("SCIENTIFIC_INTRESTS");
这是我到目前为止所做的代码。
<input type="checkbox" name="SCIENTIFIC_INTRESTS" value="Database">Database<br>
<input type="checkbox" name="SCIENTIFIC_INTRESTS" value="Web_Programming">WEB PROGRAMMING<br>
<input type="checkbox" name="SCIENTIFIC_INTRESTS" value="Data_Mining">Data Mining<br>
<input type="checkbox" name="SCIENTIFIC_INTRESTS" value="Human_Computer Interaction">Human Computer Interaction<br>
<input type="checkbox" name="SCIENTIFIC_INTRESTS" value="Software_Engineering">Software Engineering<br>
<input type="checkbox" name="SCIENTIFIC_INTRESTS" value="Information_Retrieval">Information Retrieval<br>
<input type="checkbox" name="SCIENTIFIC_INTRESTS" value="Software_Quality">Software Quality<br>
<input type="checkbox" name="SCIENTIFIC_INTRESTS" value="e-commerce"> e-commerce<br>
<input type="checkbox" name="SCIENTIFIC_INTRESTS" value="Management_Information Systems,">Management Information Systems<br>
<input type="checkbox" name="SCIENTIFIC_INTRESTS" value="Information_Systems">Information Systems<br>
答案 0 :(得分:0)
试试这个字符串[] SCIENTIFIC_INTRESTS = request.getParameterValues(“SCIENTIFIC_INTRESTS”);
答案 1 :(得分:0)
Suppose Your code is in page1.jsp and i am submitting to that in page2.jsp or servlet.to get all the checkbox value you need to write code following way.
String values[] = request.getParameterValues("SCIENTIFIC_INTRESTS");
for (int i = 0; i < values.length; i++) {
out.print(values[i]);
}