Reputation: 785
I have an application, where a button must call a spring controller. How do I connect them together? I have not found any clear information yet.
Upvotes: 0
Views: 221
Reputation: 608
Directly call your API in href
in <a>
tag
API : http://192.168.1.17:8080/product/download/excel
<a href="/product/download/excel" > Start Download </a>
Controller :
@RequestMapping(value="/product/download/excel", method=RequestMethod.GET)
public Object downloadExcel(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse){
return productService.downloadExcel(httpServletRequest,httpServletResponse);
}
Upvotes: 2