@FormParam
Defines the name of the form parameter whose value will be used to initialize the value of the annotated method argument.
Works only with POST request
Code
package com.candidjava.webservices.controller;
import javax.ws.rs.FormParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import com.candidjava.webservices.bean.User;
@Path("/User")
public class RegisterProcess {
@POST
@Path("/RegisterProcess")
@Produces(MediaType.APPLICATION_JSON)
public Response getRegisterDetails(
@FormParam("txt_username") String username,
@FormParam("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