簡體   English   中英

如何在CXF Web服務中獲取請求參數

[英]How to get request parameter in cxf webservice

我是cxf Web服務的新手。

我有一個webservice類,其中我有一個方法可以根據通過html表單發送的請求中的id刪除學生。

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

現在我的問題是,當我嘗試以localhost/student/deleteStudent?studentId=abc身份訪問此URL時

我正在將studentId作為空字符串“”而不是“ abc”。 我做錯什么了嗎?

任何幫助都會非常有幫助。

我解決了這個問題。 我們應該在方法上使用@FormParam而不是@RequestParam,以在url中獲取參數的值。

@得到
@Path(“ / deletestudentent”)
@Description(value =“刪除已識別的學生”)
公共響應deleteStudent(
@FormParam (“ studentId”)
@Description(value =“要刪除的學生ID”)
final String studentId){

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM