@QueryParam
Defines the name of the HTTP query parameter whose value will be used to initialize the value of the annotated method argument, class field or bean property.
Can be used only with GET request
Code
package com.candidjava.webservices.controller;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import com.candidjava.webservices.bean.User;
@Path("/User")
public class RegisterProcess {
@GET
@Path("/RegisterProcess")
@Produces(MediaType.APPLICATION_JSON)
public Response getRegisterDetails(
@QueryParam("txt_username") String username,
@QueryParam("txt_password") String password) {
System.out.println(username);
System.out.println(password);
User user = new User(username, password);
return Response.ok().status(200).entity(user).build();
}
// *************************************************
}
Screenshot
Download