QueryParam Annotation In Jersey

 @QueryParam Annotation In  Jersey

Example:

http://localhost:8080/JerseyDemo/rest/user/12?p=10

@Path(“/user”)
public class UserHander {

    @GET
    @Path(“/{id}”)
    public Response addUser(@PathParam(“id”) int id,@QueryParam(“p”) int page) {
        System.out.println(“id=” + id+”page=”+page);
        String str = “id is=” + id+”page=”+page;
        return Response.status(Status.OK).entity(str).build();
    }

}

Output:

id is=12page=10

Leave a Reply

Your email address will not be published. Required fields are marked *

98 − = 95