【发布时间】:2017-08-04 20:27:47
【问题描述】:
如果正确加载了值,我不会在 Angular 服务中从前到后获取我的参数: 如果 embarno 没有到达后端,同样的代码可以在 Jhipster 4.4.1 的垄断应用程序中正常工作。 现在还没迁移,在4.6.2版本的微服务中,不知道是不是改了发送参数的语法。
控制器:
this.contactoService.byCliente(this.cliente.id).subscribe(
result => { this.contactos = result; },
error => { console.debug(error); });
服务:
byCliente(clienteId?: any): Observable<Contacto[]> {
let params = new URLSearchParams();
params.set('clienteId', clienteId);
return this.http.get(this.resourceUrl + "/bycliente", { search: params }).map((res: Response) => {
return res.json();
});
}
返回(微服务):
@GetMapping("/contactos/bycliente")
@Timed
public ResponseEntity<List<ContactoDTO>> getAllContactosByCliente(@RequestParam String clienteId) {
log.debug("REST request to get a page of Contactos");
List<ContactoDTO> list = contactoService.findContactosByCliente(clienteId);
return new ResponseEntity<>(list, HttpStatus.OK);
}
错误:
An unexpected error occurred: Required String parameter 'clienteId' is not present org.springframework.web.bind.MissingServletRequestParameterException: Required String parameter 'clienteId' is not present
【问题讨论】:
-
我为隐私问题重命名了它,它已经修复了。
-
没有足够的详细信息来获取帮助。浏览器发送的 HTTP 请求转储怎么样?