daily pastebin goal
67%
SHARE
TWEET

Untitled

a guest Jan 24th, 2016 103 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 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.    
  3. <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
  4. <%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
  5.  
  6. <%--
  7.     Document   : TestAllocMainPage
  8.     Created on : Dec 7, 2015, 6:38:37 PM
  9.     Author     : zanxzanz
  10. --%>
  11.  
  12. <%@page import="java.sql.ResultSet"%>
  13. <%@ page import="java.sql.*" %>
  14. <%ResultSet modelSet = null;%>
  15.  
  16.  
  17. <%@page contentType="text/html" pageEncoding="UTF-8"%>
  18. <!DOCTYPE html>
  19. <html>
  20.     <head>
  21.         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  22.         <title>Test Alloc</title>
  23.     </head>
  24.     <body>
  25.        <FORM method="POST" ACTION="NextForm.jsp">
  26.  
  27.            <%
  28.             try {
  29.                 Class.forName("com.mysql.jdbc.Driver").newInstance();
  30.                 Connection connection
  31.                         = DriverManager.getConnection("jdbc:mysql://localhost/test_management", "root", "admin");
  32.  
  33.  
  34.                 Statement statement1 = connection.createStatement();
  35.                 modelSet = statement1.executeQuery("select * from manage_model");
  36.                 %>
  37.  
  38.  
  39. <center>
  40. Select(s): <br><br>
  41. <table>
  42. <tr>
  43.     <td>Select Model:</td>
  44.     <td><select name="model" id="tb1">
  45.                         <%
  46.                         while (modelSet.next()) {%>
  47.                         <option><%=modelSet.getString(3)%></option>
  48.                         <% } %>
  49.                     </select></td>
  50.  
  51. </table>
  52. <br><br>
  53. <table
  54. <tr>  
  55.  
  56.     <td>
  57.         <input TYPE=checkbox name=member value =Name1>
  58.     </td>    
  59.     <td>    
  60.         Tester1
  61.     </td>
  62. </tr>
  63.  
  64. <tr>
  65.     <td>
  66.         <input TYPE=checkbox name=member VALUE=Name2>
  67.     </td>    
  68.     <td>    
  69.         Tester2
  70.     </td>
  71. </tr>
  72.  
  73. <tr>
  74.     <td>
  75.         <input TYPE=checkbox name=member VALUE=Name3>
  76.     </td>    
  77.  
  78.     <td>    
  79.         Tester3
  80.     </td>
  81. </tr>
  82.  
  83. <tr>
  84.     <td>
  85.         <input TYPE=checkbox name=member VALUE=Name4>
  86.     </td>    
  87.  
  88.     <td>    
  89.         Tester4
  90.     </td>
  91. </tr>
  92.  
  93. <tr>
  94.     <td>
  95.         <input TYPE=checkbox name=member VALUE=Name5>
  96.     </td>    
  97.  
  98.     <td>    
  99.         Tester5
  100.     </td>
  101. </tr>
  102. </table>
  103. <br> <INPUT TYPE=submit name=submit Value="Submit">
  104. </center>
  105.                     <%
  106.         //**Should I input the codes here?**
  107.             } catch (Exception e) {
  108.                 out.println("wrong entry" + e);
  109.             }
  110.         %>
  111.  
  112. </FORM>
  113.     </body>
  114. </html>
  115.    
  116. 1)Selected Names(checkbox) will be displayed in textbox
  117.    2)In 'mail' textbox email-id should be retrieved from mysql based on the 'Names' selected.
  118.    
  119. <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
  120. <%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
  121.  
  122. <%--
  123.     Document   : TestAllocProceedMain
  124.     Created on : Dec 15, 2015, 10:37:04 AM
  125.     Author     : zanxzanz
  126. --%>
  127.  
  128. <%@page import="java.sql.ResultSet"%>
  129. <%@ page import="java.sql.*" %>
  130. <%ResultSet mailSet = null;%>
  131.  
  132. <%@page contentType="text/html" pageEncoding="UTF-8"%>
  133. <!DOCTYPE html>
  134. <html>
  135.     <head>
  136.         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  137.         <title>TAP</title>
  138.     </head>
  139.     <body>
  140.         <%! String[] members; %>
  141.         <%! String models; %>
  142.         <%! String mail; %>
  143.     <center>Allocation Details: <br>
  144.  
  145.         <%
  146.  
  147.             String a = request.getParameter("member1");
  148.  
  149.             try {
  150.                 Class.forName("com.mysql.jdbc.Driver").newInstance();
  151.                 Connection connection
  152.                         = DriverManager.getConnection("jdbc:mysql://localhost/test_management", "root", "admin");
  153.                 Statement statement1 = connection.createStatement();
  154.  
  155.                 mailSet = statement1.executeQuery("select Email_Id from team_member where Emp_Name ='Name1'");
  156.  
  157.                 %>
  158.         <table>
  159. <%
  160.    members = request.getParameterValues("member");
  161.    models = request.getParameter("model");
  162.  
  163.  
  164.    if (members != null)
  165.    {
  166.       for (int i = 0; i < members.length; i++)
  167.       {
  168.          //out.println ("<b> Tester"+i+ ": <b>");
  169.          %>
  170.          <input type="text" name="test" value="<%=models%>" />
  171.          <input type="text" name="test" value="<%=members[i]%>"/>
  172.     //**Email**
  173.     <input type="text" name="mail" value="<%=mail%>" />
  174.          <br><br>
  175.     <%
  176.       }
  177.  
  178.    }
  179.    else out.println ("<b>none<b>");
  180. %>
  181. </td></tr>
  182. </table>
  183.  
  184. <%
  185.  
  186.             } catch (Exception e) {
  187.                 out.println("wrong entry" + e);
  188.             }
  189.         %>
  190.  
  191. </center>
  192.  
  193.     </body>
  194. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top