-
Notifications
You must be signed in to change notification settings - Fork 43
/
c.jsp
26 lines (26 loc) · 1.05 KB
/
c.jsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<%@page contentType="text/html" pageEncoding="UTF-8" import="java.util.*"%>
<%@ 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>Info</title></head>
<body><sql:setDataSource var="con" driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/s2c130050131530"
user="root" password=""/>
<%
Date DoB = new Date("1995/09/12");
int studentId = 103;
%>
<sql:update dataSource="${con}" var="count">
UPDATE student SET dob = ? WHERE Id = ?
<sql:dateParam value="<%=DoB%>" type="DATE" />
<sql:param value="<%=studentId%>" />
</sql:update>
<sql:query dataSource="${con}" var="result">
SELECT * from student;</sql:query>
<table border="1">
<tr><th>Emp ID</th><th>First Name</th><th>Last Name</th><th>DoB</th></tr>
<c:forEach var="row" items="${result.rows}">
<tr><td><c:out value="${row.id}"/></td>
<td><c:out value="${row.first}"/></td>
<td><c:out value="${row.last}"/></td>
<td><c:out value="${row.dob}"/></td></tr></c:forEach></table></body>
</html>