Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%@page import="javax.servlet.http.*,javax.servlet.*" %>
- <%@page import="java.io.*,java.util.*,java.sql.*"%>
- <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
- <%@taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
- <html>
- <body>
- <% try { %>
- <% int roll=Integer.parseInt(request.getParameter("roll")); %>
- <% String name=request.getParameter("name"); %>
- <% float marks=Float.parseFloat(request.getParameter("marks")); %>
- <sql:setDataSource var ="snapshot" driver="com.mysql.jdbc.Driver"
- url ="jdbc:mysql://localhost/test"
- user ="root" password=""/>
- <sql:update dataSource="${snapshot}" var="result" >
- SELECT *from student;
- <sql:update>
- <table border="1" width="50%">
- <tr>
- <th> Roll</th>
- <th> Name </th>
- <th> Marks </th>
- </tr>
- <c:forEach var="row" items="${result.rows}">
- <tr>
- <td><c:out value="${row.roll}"/></td>
- <td><c:out value="${row.name}"/></td>
- <td><c:out value="${row.marks}"/></td>
- </tr>
- </c:forEach>
- </table>
- <% } catch (Exception e) {out.print("Wrong Data Entry \n"); %>
- <br/><br/>
- <% } %>
- <a href="main.html">Go to Home</a>
- </body>
- </html>
Add Comment
Please, Sign In to add comment