如何通过选中复选框中的选项来检索文本框中的数据?
完整要求说明:
1)在复选框中选择多个选项。 例如:选择复选框的多个名称。
2)点击提交按钮。
2)在下一页中,应显示其他列的数据。 例如:所有电子邮件ID都应根据前一页中的“名称”选项显示在文本框中
要求:使用JSP和Mysql的简单代码
**
Form1中:
$('#summernote').summernote('code')
**
1)It contains Checkbox: User selects the check box and clicks on submit button. (Moves to next Form i.e Form2 - Check the next set of code below)
**
窗体2:
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%> <%-- Document : TestAllocMainPage Created on : Dec 7, 2015, 6:38:37 PM Author : zanxzanz --%> <%@page import="java.sql.ResultSet"%> <%@ page import="java.sql.*" %> <%ResultSet modelSet = null;%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Test Alloc</title> </head> <body> <FORM method="POST" ACTION="NextForm.jsp"> <% try { Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection connection = DriverManager.getConnection("jdbc:mysql://localhost/test_management", "root", "admin"); Statement statement1 = connection.createStatement(); modelSet = statement1.executeQuery("select * from manage_model"); %> <center> Select(s): <br><br> <table> <tr> <td>Select Model:</td> <td><select name="model" id="tb1"> <% while (modelSet.next()) {%> <option><%=modelSet.getString(3)%></option> <% } %> </select></td> </table> <br><br> <table <tr> <td> <input TYPE=checkbox name=member value =Name1> </td> <td> Tester1 </td> </tr> <tr> <td> <input TYPE=checkbox name=member VALUE=Name2> </td> <td> Tester2 </td> </tr> <tr> <td> <input TYPE=checkbox name=member VALUE=Name3> </td> <td> Tester3 </td> </tr> <tr> <td> <input TYPE=checkbox name=member VALUE=Name4> </td> <td> Tester4 </td> </tr> <tr> <td> <input TYPE=checkbox name=member VALUE=Name5> </td> <td> Tester5 </td> </tr> </table> <br> <INPUT TYPE=submit name=submit Value="Submit"> </center> <% //**Should I input the codes here?** } catch (Exception e) { out.println("wrong entry" + e); } %> </FORM> </body> </html>
**
1)Selected Names(checkbox) will be displayed in textbox
2)In 'mail' textbox email-id should be retrieved from mysql based on the 'Names' selected.