Error Http 500 using jsp
Hi, I am new to using JSP and tomcat and I am trying to display images from my database but I keep getting this error.
An error occurred at line: 7 in the jsp file: /booksavers/categories.jsp
CatId cannot be resolved
4: <%
5: int CatID = Integer.parseInt(request.getParameter("CatID"));
6: PreparedStatement statement = con.prepareStatement("select * from Book where CatId = ?");
7: statement.setInt(1,CatId);
8: ResultSet resultSet = statement.executeQuery();
9: %>
10:
An error occurred at line: 18 in the jsp file: /booksavers/categories.jsp
CatId cannot be resolved
15: </head>
16:
17: <body>
18: <h1 align="center">Categories = <%= CatId %></h1>
19: <p>
20: <table align="center">
21: <tr>
I am not quite sure what is the problem here, the following below shows the code I have used.
<%@ include file ="connection.jsp" %>
<%
int CatID = Integer.parseInt(request.getParameter("CatID"));
PreparedStatement statement = con.prepareStatement("select * from Book where CatId = ?");
statement.setInt(1,CatId);
ResultSet resultSet = statement.executeQuery();
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Categories</title>
</head>
<body>
<h1 align="center">Categories = <%= CatId %></h1>
would someone please help me out with this.
Thanks
nubileras
|