简体   繁体   中英

How to get request parameter in cxf webservice

I am new to the cxf webservices.

I have a webservice class in whihc i have a method to delete a student based on id send in request through a html form.

@GET
@Path("/deletestudent")
@Description(value="Delete the identified student")
public Response deleteStudent(@RequestParam("studentId") 
     @Description(value="Student ID to delete") final String studentId) {

Now my problem is this that when i try to access this url as localhost/student/deleteStudent?studentId=abc

I am getting studentId as empty string "" instead of "abc". Is i am doing something wrong?

Any help will be very helpful.

I got this problem solved. We should use @FormParam instead of @RequestParam on the method to get the parameter's value in the url.

@GET
@Path("/deletestudent")
@Description(value="Delete the identified student")
public Response deleteStudent(
("studentId") (“ studentId”)
@Description(value="Student ID to delete")
final String studentId) {

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM