使用单个字符串变量传递@Requestparam中的多个键

问题描述 投票:0回答:1

In this Image I have to search person by based on dropdown selection

我想通过@Requestparam传递此选择,我有多个键名,但是我想一次传递一个键,所以,无论参数来自请求应提取的参数,我都只想使用一个字符串一个字符串中的键值

我不要这样@RequestParam(value = "pname", required = false) String pName, @RequestParam(value = "ssn", required = false) String sSN)

我想要这样的东西(即具有单个字符串变量的多个键值]

    public List<Patient> getPatientListLike(@RequestParam(required = false) String searchString)
java spring spring-boot spring-mvc spring-restcontroller
1个回答
0
投票

您可以在UI代码中将searchString创建为ssn = ssnValue(用户在屏幕上选择的ssnValue,并将其传递给url。


0
投票

您可以使用HttpServletRequest请求获取查询字符串

public List<Patient> getPatientListLike(HttpServletRequest request) {

    String searchString = request.getQueryString();

}
© www.soinside.com 2019 - 2024. All rights reserved.