I have a college exercise in which I have to create a .jsp page that receives a "id" parameter and runs a query to delete the record inside the class products with this id and in case of any exception I send the user to page error.html passing as parameter the text of the error. The code I've made so far is this:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" import="web.acesso.bd.*,web.acesso.bd.dao.*"%>
<html>
<head><title>Insert title here</title></head>
<body>
<%
int myId=request.getParameter("id")
try{
bd.execComando ("DELETE FROM Filme id="+myId+");
}
catch(Exception e)
{
response.sendRedirect("erro.html");
}%>
</body>
</html>
So far I think that's right, but I do not know how to pass as parameter the exception message that is in the variable "and". Could someone help?