【发布时间】:2018-06-02 07:54:10
【问题描述】:
我尝试使用 Querydsl 实现搜索过滤器。我的搜索过滤器功能运行良好。但我通过在控制器中提供硬编码值来测试这一点。
现在我想从 Angular 应用程序中获取该搜索参数。在get request中如何从angularsClientAcctId, sAcctDesc,sInvestigatorName,sClientDeptId接收这个参数
谁能告诉我怎么做?
AccountController.java
@GetMapping("/findAccountData")
public ResponseEntity<List<Tuple>> populateGridViews(String sClientAcctId, String sAcctDesc,String sInvestigatorName,String sClientDeptId) throws Exception {
return ResponseEntity.ok(accService.populateGridViews(sClientAcctId, sAcctDesc,sInvestigatorName,sClientDeptId));
}
我使用@PathVariable 尝试过这样的操作,但在这里我需要传递所有参数然后只有请求匹配,否则我得到 404
我的功能是,如果我没有传递任何参数,那么我想要所有数据,如果我只传递一个参数,然后像这样根据那个参数值进行搜索
@GetMapping("/findAccountData/{clientAcctId}/{acctDesc}/{investigatorName}/{clientDeptId}")
public ResponseEntity<List<Tuple>> populateGridViews(
@PathVariable("clientAcctId") String sClientAcctId,
@PathVariable("acctDesc") String sAcctDesc,
@PathVariable("investigatorName") String sInvestigatorName ,
@PathVariable("clientDeptId") String sClientDeptId) throws Exception {
【问题讨论】:
-
但在这里我的应用程序中没有视图。我想从 Angular 应用程序接收它
-
这无关紧要。答案显示了如何接收查询参数,不管它们来自什么客户端。
-
意味着我可以使用
@RequestParam从我的电脑上没有的角度应用程序接收参数
标签: java spring-mvc