I am beginner for Java and REST API. I have a problem passing form data from HTML to rest PUT
method. When I google about this, most solutions available are for POST
method, that recommended to use FormParam
. In my case, it shows below error:
The method received in the request-line is known by the origin server but not supported by the target resource.
Even I use PathParam
, same error is returned:
The method received in the request-line is known by the origin server but not supported by the target resource.
And some solution for Spring Boot. But I did not use that.
PUT method:
@PUT
@Path("/update")
@Produces(MediaType.TEXT_HTML)
public String updCard(@PathParam("cardNo") String cardNo,
@PathParam("reportId") int reportId
) throws SQLException {
Card c = new Card(cardNo, reportId);
System.out.println(cardNo + reportId);
return "";
}
Form:
<form method="PUT" action="rest/card/update">
<label for = "cardNo">Card No: </label> <input type="text" name = "cardNo" id = "cardNo"><br/>
<label for = "reportId">Report Id:</label> <input type="text" name = "reportId" id = "reportId"> <br/>
<button type="submit">Update</button>
So, how do I get the form data in PUT
method in Jersey?