I want to provide an option to download this generated JSP page as a .doc file. How can I achieve this in Spring MVC?
<%@ page import="java.text.SimpleDateFormat, java.util.Date" %>
<%
SimpleDateFormat formatter = new SimpleDateFormat("dd MMMM, yyyy");
String currentDate = formatter.format(new Date());
%>
<%@include file="/WEB-INF/views/header.jsp"%>
<%@include file="/WEB-INF/views/datatablelibjs.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Portal Email Template</title>
</head>
<body>
<p><strong>Subject:</strong> Application for grant of License</p>
<p>Date: <%= currentDate %></p>
<p>Content of the document...</p>
</body>
</html>
Controller
@RequestMapping(value = "/dfa1-circulation" , method = RequestMethod.GET)
public String showDfa1CirculationLetter(Model model, @RequestParam("appId") Long appId) {
LmApplicationIl lmail = summaryService.getLmIlApplication(appId);
model.addAttribute("lmail", lmail);
List<LmApplicationItemDetailsIlBean> itemList = summaryService.getItemList(appId);
model.addAttribute("itemList", itemList);
List<IlPhashIIApplicationStatusBean> statusBeanList = ilPhashIIService.getIlPhashIIApplicationStatusList(appId);
model.addAttribute("statusBeanList", statusBeanList);
return "dfa1CirculationLetter";
}