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");
}