File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes forward problem after create excel file Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply 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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: forward problem after create excel file
 
Similar Threads
inputting the excel file to java servlet pgm
how to extract data to an xl sheet
Enable icon once download request is processed.
download zipped excel help!!!
apache pio?