Guest User

Untitled

a guest
Aug 18th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. <jsp:scriptlet>
  2. try {
  3. Connection con = ConnectionFactory.getConnection();
  4. Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
  5. ResultSet.CONCUR_READ_ONLY);
  6.  
  7.  
  8. String strQry = "";
  9. String sId = request.getParameter("_sid");
  10.  
  11. if (sId.isEmpty())
  12. {
  13. response.getWriter().println("<h3>Invalid input.</h3>");
  14. return;
  15. }
  16. //The next 5 lines are an experiment. By moving them around in the block,
  17. //I attempt to see where
  18. //netbeans is complaining. It doesn't seem to like the "if" statement above.
  19. }
  20. catch (Exception e)
  21. {
  22. }
  23. </jsp:scriptlet>
  24.  
  25. <jsp:scriptlet>
  26. //end experiment
  27.  
  28.  
  29. // if (request.getParameter("retrieveButton").equals("Retrieve Record"))
  30. // {
  31. // strQry = "DELETE FROM Record WHERE s_id='" + request.getParameter("_sid") + "'";
  32. // }
  33.  
  34.  
  35.  
  36. stmt.execute(strQry);
  37.  
  38. response.getWriter().println("<h3>Record " + sId + " deleted.");
  39. }
  40. catch (SQLException sqle)
  41. {
  42. response.getWriter().println("<h3>Error: Record not in database</h3>");
  43. }
  44.  
  45. </jsp:scriptlet>
Add Comment
Please, Sign In to add comment