Advertisement
Guest User

Untitled

a guest
May 10th, 2016
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. HTTP Status 405 - Method Not Allowed
  2.  
  3. type Status report
  4.  
  5. message Method Not Allowed
  6.  
  7. description The specified HTTP method is not allowed for the requested resource.
  8.  
  9. @DELETE
  10. @Path("/delete")
  11. @Produces(MediaType.TEXT_HTML)
  12. public void delEmployeeFormParam(@FormParam("Employee_id") int employee_id){
  13.  
  14. java.net.URI location= null;
  15. System.out.println("teting");
  16. try
  17. {
  18. Class.forName("com.mysql.jdbc.Driver");
  19. Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/Employee_db", "root", "root");
  20.  
  21. String query = "delete from employee where emp_id = (?)";
  22.  
  23. PreparedStatement st = con.prepareStatement(query);
  24. st.setInt(1, employee_id);
  25. st.executeQuery();
  26.  
  27. }
  28. catch (Exception e)
  29. {
  30. System.out.println(e.getMessage());
  31. }
  32.  
  33. }
  34.  
  35. <body>
  36. <h3> Enter Employee Id to Delete </h3>
  37.  
  38. <div>
  39. <form method="DELETE" action="http://localhost:8080/RESTCRUD/rest/employee/delete">
  40. <p>Employee Id: <input type:"text" name="Employee_id"/></p>
  41. <input type="submit" value="submit"/>
  42. </form>
  43. </div>
  44.  
  45. </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement