jsp代码:
<input id="exportwork" class="btn btn-primary" type="button" value="导出"/>
js代码:自己写点击事件跳转到后台方法即可,我这是用form表单进行提交跳转的
$("#exportwork").bind("click",function(){
$("#searchForm").attr("action","adfadsfadsf/exportWorkbillFile");
$("#searchForm").submit();
});
后台controller中代码:
@RequestMapping(value = "exportWorkbillFile")
public String exportWorkbillFile(Workbill workbill, Model model, HttpServletRequest request,
HttpServletResponse response, RedirectAttributes redirectAttributes) {
//String contentType = "application/vnd.ms-excel;charset=UTF-8";
String fileName = "workbill";
List<Workbill > workbilllist=workbillService.findList(w