String pnumber = request.getParameter("pnumber");
ResultSet rs = DAO.fetch("SELECT * FROM Products Where ProductNumber ='" + pnumber + "'");
ResultSet r = DAO.fetch("SELECT * FROM ExpensiveProducts");
ここで私はデータベースからデータを取得しています:
try {
int v = Integer.parseInt(pnumber);
if (pnumber.length() == 7) {
この状態でデータが渡されませんか?
while (rs.next()) {
String pn = rs.getString(3);
String pqty = rs.getString(4);
int qty = Integer.parseInt(pqty);
if (pn.equals(pnumber)) {
if (qty > 0) {
response.sendRedirect("Status.jsp?Status=Available");
} else {
response.sendRedirect("Status.jsp?Status=Not Available");
}
} else {
while (r.next()) {
String epn = r.getString(3);
String epp = r.getString(4);
out.print(pnumber);
out.print(epn);
if (epn.equals(pnumber)) {
response.sendRedirect("Status.jsp?Status=EAvailable");
} else {
response.sendRedirect("Status.jsp?Status=E NAvailable");
}
}
response.sendRedirect("Status.jsp?Status=Product number not exist");
}
}
} else {
response.sendRedirect("Status.jsp?Status=test");
}