Hey guys, for some reason I cannot update information to my database via jsp. The source is below, can anyone please point out why I cannot do a simple update statement? The <setDataSource is changed so it's not an issue> Everything works correctly except for that <sql:update> part.
${param.id} is coming from another jsp page
<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' %>
<%@ taglib prefix='sql' uri='http://java.sun.com/jsp/jstl/sql' %>
<sql:setDataSource
driver='com.mysql.jdbc.Driver'
url='jdbc:mysql://localhost/cs320stu**'
user='cs320stu**'
password='***'
/>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Editing Student</title>
</head>
<body>
<c:if test="${not empty param.update }">
<sql:update>
UPDATE students
SET firstname = ?
WHERE student_id = ?
<sql:param value="${param.fn }" />
<sql:param value="${param.id }" />
</sql:update>
</c:if>
<c:if test="${empty param.id }">
<c:redirect url="MainStudentPage.jsp" />
</c:if>
<sql:query var='result' sql='select firstname, lastname, age from students where student_id = ${param.id }' />
<form action ='EditStudent.jsp' method='post'>
<table border='5' align='center' cellspacing='5'>
<tr align='center'>
<td><label>Firstname</label><input type='text' name='fn' value='${result.rowsByIndex[0][0] }'/></td>
</tr>
<tr align='center'>
<td><label>Lastname</label><input type='text' name='ln' value='${result.rowsByIndex[0][1] }'/></td>
</tr>
<tr align='center'>
<td><label>Age</label><input type='text' name='age' value='${result.rowsByIndex[0][2] }'/></td>
</tr>
</table>
<center><input type='submit' name='update' value='Update!' /></center>
</form>
</body>
</html>
Thank you