public class mySevlet extends HttpServlet {
public void doPost(HttpServletRequest req, HttpServletResponse res) throws
ServletException, IOException {
try
{
HSSFWorkbook wb = myclass.dostuff();
res.setContentType("application/vnd.ms-excel");
OutputStream outN = res.getOutputStream();
wb.write(outN);
outN.flush();
} catch(Exception e)
{
System.out.println("Excepcion " + e);
}
Nombre="name.xls"; // This not necesary
goTo(req,res,Nombre);
}
public void goTo(HttpServletRequest req, HttpServletResponse res, String nombre) {
RequestDispatcher rd = req.getRequestDispatcher( nombre );
try {
rd.forward(req,res);
}
catch (Exception e) {
System.out.println("ERROR dispatcher " + e);
}
}
}