Guest User

Untitled

a guest
Jun 8th, 2018
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. <%@page import="javax.servlet.http.*,javax.servlet.*" %>
  2. <%@page import="java.io.*,java.util.*,java.sql.*"%>
  3. <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
  4. <%@taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
  5.  
  6. <html>
  7.  
  8. <body>
  9. <% try { %>
  10. <% int roll=Integer.parseInt(request.getParameter("roll")); %>
  11. <% String name=request.getParameter("name"); %>
  12. <% float marks=Float.parseFloat(request.getParameter("marks")); %>
  13. <sql:setDataSource var ="snapshot" driver="com.mysql.jdbc.Driver"
  14. url ="jdbc:mysql://localhost/test"
  15. user ="root" password=""/>
  16. <sql:update dataSource="${snapshot}" var="result" >
  17. SELECT *from student;
  18. <sql:update>
  19. <table border="1" width="50%">
  20. <tr>
  21. <th> Roll</th>
  22. <th> Name </th>
  23. <th> Marks </th>
  24. </tr>
  25. <c:forEach var="row" items="${result.rows}">
  26. <tr>
  27. <td><c:out value="${row.roll}"/></td>
  28. <td><c:out value="${row.name}"/></td>
  29. <td><c:out value="${row.marks}"/></td>
  30. </tr>
  31. </c:forEach>
  32. </table>
  33. <% } catch (Exception e) {out.print("Wrong Data Entry \n"); %>
  34. <br/><br/>
  35. <% } %>
  36. <a href="main.html">Go to Home</a>
  37. </body>
  38. </html>
Add Comment
Please, Sign In to add comment