<%@ page import="java.io.*,java.util.*,java.sql.*"%> <%@ page import="javax.servlet.http.*,javax.servlet.*" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%> <html> <head> <title>JINSERT Operation</title> </head> <body> <form id="form1" name="form1" method="post" action=""><fieldset> <sql:setDataSource var="snapshot" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/dmd" user="root" password="root"/> <sql:query dataSource="${snapshot}" var="result"> SELECT * from company; </sql:query> <p>Company Name : <select name="companyName"> <option> <c:forEach items="${result.rows}" var="row"> <option value="${row.companyName}"><c:out value="${row.companyName}"/></option> </c:forEach> </option> </select> <p> </p> <sql:setDataSource var="snapshot" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/dmd" user="root" password="root"/> <sql:query dataSource="${snapshot}" var="result"> SELECT * from employee; </sql:query> <p>Employee Name : <select name="employeeName"> <option> <c:forEach items="${result.rows}" var="row"> <option value="${row.empName}"><c:out value="${row.empName}"/></option> </c:forEach> </option> </select> <p> </p> <p>Team Name : <input type="text" name="teamName" value="${row.teamName }"/> </p> <p> </p> <sql:setDataSource var="snapshot" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/dmd" user="root" password="root"/> <sql:query dataSource="${snapshot}" var="result"> SELECT * from employee; </sql:query> <p>Employee ID : <select name="eid"> <option> <c:forEach items="${result.rows}" var="row"> <option value="${row.empID}"><c:out value="${row.EmpID}"/></option> </c:forEach> </option> </select> <p> </p> <p>Location No From : <input type="text" name="location" id="location" value="${row.location }"/> </p> <p> </p> <p>Location No To : <input type="text" name="location2" id="location2" value="${row.location2 }"/> </p> <p> </p> <p>Total Seats : <input type="text" name="totalSeats" id="totalseats" value="${row.totalSeats }"/> </p> <p> </p> <p>Valid From : <input type="text" name="from1 "id="datepicker" value="${row.from1 }"/> </p> <p> </p> <p>Valid To : <input type="text" name="to1" id="datepicker1" value="${row.to1 }" /> </p> <p> </p> <p>Comments : <input type="text" name="comments" id="comments" value="${row.comments }"/> </p> <p> </p> <input type="submit" name="submit" value="ASSIGN"/> <sql:setDataSource var="snapshot" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/dmd" user="root" password="root"/> <sql:update dataSource="${snapshot}" var="result"> INSERT INTO assignseats VALUES ('+eid+','+employeeName+','+teamName+','+companyName+','+location+','+location2+','+totalSeats+''+from1+','+to1+','+comments+'); </sql:update> <sql:query dataSource="${snapshot}" var="result"> SELECT * from assignseats; </sql:query> <table border="1" width="100%"> <tr> <th>Emp ID</th> <th>Employee Name</th> <th>Company Name</th> <th>Team Name</th> <th>Valid From</th> <th>Valid To</th> <th>Location From</th> <th>Location To</th> <th>Total Seats</th> <th>Comments</th> </tr> <c:forEach var="row" items="${result.rows}"> <tr> <td><c:out value="${row.eid}"/></td> <td><c:out value="${row.employeeName}"/></td> <td><c:out value="${row.companyName}"/></td> <td><c:out value="${row.teamName}"/></td> <td><c:out value="${row.totalSeats}"/></td> <td><c:out value="${row.from1}"/></td> <td><c:out value="${row.to1}"/></td> <td><c:out value="${row.location}"/></td> <td><c:out value="${row.location2 }"/></td> <td><c:out value="${row.comments }"/></td> </tr> </c:forEach> </table> </fieldset> </form> </body> </html>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)