Jersey RESTful WebService框架学习(四)使用@FormParam
前端
<form action="/Jersey/api/1.0/my/form" method="post"> <input type="text" name="name"> <input type="submit" value="提交"> </form>
后端
@POST @Path("/form") @Produces({ MediaType.APPLICATION_JSON + ";charset=UTF-8" }) public String form(@FormParam("name") String name) { System.out.println(name); return "{\"name\":\""+name+"\"}"; }