Here is the Server Side Code
@POST
@Path("/post/withresponse/onlystring")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public Response createTrackInJSONFormString(
String trackName) {
String result = "Track saved : " + trackName;
System.out.println("trackname from the User is : "+ trackName+" and result"+result);
Gson gson = new Gson();
Person person = new Person();
person.setName("Kiran");
person.setAge("21");
person.setAddress("123 Main Street");
String jsonString = gson.toJson(person);
System.out.println("This is the messagePost from Jersey Service SERVICE_NAME is 333333 /post/withresponse/onlystring");
return Response.status(201).entity(jsonString).build();
}
Here is the Sample
JSP Client
<form id="postFormThree" action="./rest/shade/post/withresponse/onlystring"
method="post">
<input type="text" name="trackName" value="onlyStringStrackNameONLY">
<input type="submit" name="submitPost" value="submitPost-FORM-postFormThree" />
</form>
Both were working when I tested them on Jersey-bundle-1.16