Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2016
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
  2. pageEncoding="ISO-8859-1"%>
  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. <%@page import="java.sql.*"%>
  6. <%@page import="java.io.*"%>
  7. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  8. <html>
  9. <head>
  10. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  11. <title>JSTL UPDATE TAG</title>
  12. </head>
  13. <body>
  14. <sql:setDataSource var="snapshot" driver="com.mysql.jdbc.Driver"
  15. url="jdbc:mysql://localhost:3306/firoz" user="root" password="system" />
  16.  
  17. <sql:update dataSource="${snapshot }" var="cont" sql="insert into mvc values (69,'dfds','dfdfsd')">
  18.  
  19. </sql:update>
  20.  
  21. <sql:query dataSource="${snapshot}" var="res">
  22. select * from mvc;
  23. </sql:query>
  24.  
  25. <table border="2" width="100%">
  26. <tr>
  27. <th>UserId</th>
  28. <th>UserName</th>
  29. <th>Password</th>
  30. </tr>
  31.  
  32. <c:forEach var="row " items="${res.rows}">
  33. <tr>
  34. <td><c:out value="${row.UserId}"></c:out></td>
  35. <td><c:out value="${row.Password}"></c:out></td>
  36. <td><c:out value="${row.UserName}"></c:out></td>
  37.  
  38. </tr>
  39. </c:forEach>
  40. </table>
  41. </body>
  42.  
  43. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement