Hello, My name is Peggie

The software that I use for my project is called eclipse as well as tomcat6. I created my database using sql query browser

Currently, I am doing project on online store and would like to edit my beanie record in case I key in the info incorrectly. However it is in error
Hence, I hope that you guys would help me solve this error as I am quite a newbie in it
Code:
package sg.edu.nyp.feppz;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class EditProduct
*/
public class EditProduct extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public EditProduct() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
@SuppressWarnings("unchecked")
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.setContentType("text/html");
PrintWriter out = response.getWriter();
System.out.println("MySQL Connect Example.");
Connection conn = null;
String url = "jdbc:mysql://localhost:3306/";
String dbName = "peisze";
String driver = "com.mysql.jdbc.Driver";
String userName = "root";
String password = "";
out.println(request.getRequestURI());
if(request.getParameter("ProductId")!=null && request.getParameter("ProductId")!="")
{
int ProductId = Integer.parseInt(request.getParameter("ProductId").toString());
String ProdName = request.getParameter("ProdName").toString();
String ProdColor = request.getParameter("ProdColor").toString();
String ProdDesc = request.getParameter("ProdDesc").toString();
String UnitPrice = request.getParameter("UnitPrice").toString();
String Quantity = request.getParameter("Quantity").toString();
int ProductCatId = Integer.parseInt(request.getParameter("ProdCatId").toString());
int UserId = Integer.parseInt(request.getParameter("UserId").toString());
Statement stmt;
try {
Class.forName(driver).newInstance();
conn = DriverManager.getConnection(url+dbName,userName,password);
System.out.println("Connected to the database");
ArrayList al=null;
ArrayList productList =new ArrayList();
String query = "update products set ProdName='"+ProdName+"',ProdColor='"+ProdColor+"',ProdDesc='"+ProdDesc+"',UnitPrice='"+UnitPrice+"',Quantity='"+Quantity+"',ProdCatId='"+ProdCatId+"',UserId='"+UserId+"' where ProductId="+ProductId;
stmt = conn.createStatement();
int i = stmt.executeUpdate(query);
System.out.println("query" + query);
if(i>0)
{
response.sendRedirect("ProductSucceed.jsp");
}
conn.close();
System.out.println("Disconnected from database");
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
And this is my edit jsp
Code:
<%@ page language="java" import="java.util.*;"%>
<html>
<head>
</head>
<body>
<%!
int ProductId;
String ProdName="";
String ProdColor="";
String ProdDesc="";
Float UnitPrice;
String Quantity="";
int ProdCatId;
int UserId;
List productList=null;
%>
<%
if(request.getAttribute("productList")!=null && request.getAttribute("productList")!="")
{
productList = (ArrayList)request.getAttribute("productList");
ProductId=Integer.parseInt(productList.get(0).toString());
ProdName=productList.get(1).toString();
ProdColor=productList.get(2).toString();
ProdDesc=productList.get(3).toString();
UnitPrice=Float.parseFloat(productList.get(0).toString());
Quantity=productList.get(5).toString();
ProdCatId=Integer.parseInt(productList.get(0).toString());
UserId=Integer.parseInt(productList.get(0).toString());
//out.println(ProductId);
}
%>
<form name="userform" method="post" action="./EditProduct">
<br><br><br>
<table align="center" width="300px" style="background-color:#EDF6EA;border:1px solid #000000;">
<tr><td colspan="2" style="font-weight:bold;" align="center">Edit Product</td></tr>
<tr><td colspan="2" align="center" height="10px"></td></tr>
<tr>
<td>ProductId:</td>
<td><input type="text" name="ProductId" value="<%=ProductId%>"></td>
</tr>
<tr>
<td>ProdUct Name:</td>
<td><input type="text" name="ProdName" value="<%=ProdName%>"></td>
</tr>
<tr>
<td>Product Color:</td>
<td><input type="text" name="ProdColor" value="<%=ProdColor%>"></td>
</tr>
<tr>
<td>Product Description</td>
<td><input type="ProdDesc" name="ProdDesc" value=""></td>
</tr>
<tr>
<td>Unit Price</td>
<td><input type="text" name="UnitPrice" value="<%=UnitPrice%>"></td>
</tr>
<tr>
<td>Qunatiy</td>
<td><input type="text" name="Quantity" value="<%=Quantity%>"></td>
</tr>
<tr>
<td>Product Category</td>
<td><input type="text" name="ProdCatId" value="<%=ProdCatId%>"></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="Submit" value="Edit" style="background-color:#49743D;font-weight:bold;color:#ffffff;"></td>
</tr>
<tr><td colspan="2" align="center" height="10px"></td></tr>
</table>
</form>
</body>
</html>
And my error when debug
Code:
HTTP Status 500 -
--------------------------------------------------------------------------------
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Servlet execution threw an exception
root cause
java.lang.Error: Unresolved compilation problem:
ProdCatId cannot be resolved
sg.edu.nyp.feppz.EditProduct.doPost(EditProduct.java:83)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.18 logs.
--------------------------------------------------------------------------------
Apache Tomcat/6.0.18
What do you mean by this:
Code:
java.lang.Error: Unresolved compilation problem:
ProdCatId cannot be resolved
as well as
productList = (ArrayList)request.getAttribute("productList"); in error
Hope that u guys can resolve this error asap

Thanks

Look forward to ur good news^^