I'm trying to make a shopping mall project, but I've never dealt with Jsp, so I'm not good at it. There was an error creating the product registration page.
[DB Info]
create table product_kly (
peq int primary key,
pname varchar2(40) not null,
nick varchar2(30) not null,
price int not null,
area varchar2(20) not null,
content varchar2(2000) not null,
pimage varchar2(500)
);
[form Jsp]
<form action="product_addCtrl.jsp" method="post" enctype="multipart/form-data">
<input type="hidden" name="nick" value="<%=nick %>">
product name
<input type="text" name="pname">
sell area
<input type="text" name="area">
price
<input type="number" name="price">
Content
<textarea name="content"></textarea>
<input type="file" name="pimage">
<input type="submit" value="submit">
</form>
[product_addCtrl.jsp]
<%
FileInputStream fis = null;
String nick = request.getParameter("nick");
String pname = request.getParameter("pname");
String area = request.getParameter("area");
String price = request.getParameter("price");
String content = request.getParameter("content");
String pimage = request.getParameter("pimage");
try {
File image = new File(pimage);
stmt = conn.prepareStatement("insert into product_kly (peq, pname, nick, price, area, content, pimage) " + "values((select nvl(max(peq), 0)+1 from product_kly), ?, ?, ?, ?, ?, ?)");
stmt.setString(1, pname);
stmt.setString(2, nick);
stmt.setInt(3, Integer.parseInt(price));
stmt.setString(4, area);
stmt.setString(5, content);
fis = new FileInputStream(image);
stmt.setBinaryStream(6, (InputStream) fis, (int) (image.length()));
int count = stmt.executeUpdate();
}
%>
Results of input and execution No errors found but not inserted into the table.
Please Help me, geniuses! X(