我有一个应用程序,其中一个按钮必须调用一个弹簧控制器。我如何将它们连接在一起? 我还没有找到任何明确的信息。
答案 0 :(得分:2)
直接在href
标记
<a>
中调用您的API
API:http://192.168.1.17:8080/product/download/excel
<a href="/product/download/excel" > Start Download </a>
控制器:
@RequestMapping(value="/product/download/excel", method=RequestMethod.GET)
public Object downloadExcel(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse){
return productService.downloadExcel(httpServletRequest,httpServletResponse);
}