We have created RESTful web services so far with HTTP GET and POST methods. The web service using the POST method took input in the JSON format. We can also have the POST method in the web service take input from HTML form elements. Let's create a method that handles the data posted from a HTML form. Open CourseService.java from the CourseManagementREST project. Add the following method:
@POST @Consumes (MediaType.APPLICATION_FORM_URLENCODED) @Path("add") public Response addCourseFromForm (@FormParam("name") String courseName, @FormParam("credits") int credits) throws URISyntaxException { dummyAddCourse(courseName, credits); return Response.seeOther(new URI("../addCourseSuccess.html")).build(); ...