Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a client-server web app using Java and JavaScript. I would like to call a path "delete" from a method deleteBook using queryParam. I've searched the Internet, but I'm not sure how to do this. The called method was supposed to delete a book from the database, but it doesn't. The problem lays in a method deleteBook (I have difficulties with calling a method).

What I have tried:

I came up with the following code. Would you please correct this one line of code for me?
public void deleteBook(Integer bookID) 
    {
       root.queryParam("delete","").queryParam("deleted_book_id",bookID).request().get();
    }

And here's the called method:
@GET
    @Path("delete")
    @Consumes(MediaType.APPLICATION_JSON)
    public void deleteBook(@DefaultValue("-1") @QueryParam("deleted_book_id") Integer deletedBookID)
    {
      getBookContext().removeBook(deletedBookID);
    }
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900