wood burning stoves 2.0*
The moose likes Servlets and the fly likes forward problem after create excel file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "forward problem after create excel file" Watch "forward problem after create excel file" New topic
Author

forward problem after create excel file

Eva Tang
Greenhorn

Joined: Oct 06, 2003
Posts: 12
I have a servlet that create an excel file, I want it to forward to another url if the user chose to save the excel file. How now after saving the file it shouldn't foward. can anyone help?
Thanks.
public class DBHandler extends HttpServlet
{
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
{
FormBean f = (FormBean) request.getAttribute("formHandler");
try {
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "filename=" + f.getliner() + f.getmonth()
+ f.getyear() + ".xls");
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("sheet1");
sheet.setMargin(HSSFSheet.BottomMargin, 0.5);
sheet.setMargin(HSSFSheet.LeftMargin, 0.5);
sheet.setMargin(HSSFSheet.RightMargin, 0.5);
sheet.setMargin(HSSFSheet.TopMargin, 0.5);
HSSFDataFormat format = wb.createDataFormat();
HSSFPrintSetup ps = sheet.getPrintSetup();
ps.setScale((short) 80);
ps.setLandscape(true);
ps.setFooterMargin(0.25);
ps.setHeaderMargin(0.25);
...........
// Write the output
OutputStream out = response.getOutputStream();
wb.write(out);
out.close();
getServletConfig().getServletContext().getRequestDispatcher("/jsp/dem/dem_display.jsp").forward(request, response);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: forward problem after create excel file
 
Similar Threads
download zipped excel help!!!
how to extract data to an xl sheet
Enable icon once download request is processed.
apache pio?
inputting the excel file to java servlet pgm