(JSP) This works for a web server which follows the servlet spec. If this is your path then you will need to study how the WEB-INF directory works. You do not want to serve binary content directly from a jsp.

(or Swing) - If you are talking about an application that creates an excel and the launches the file in Excel you will need to look into the Java Process class. Write your Excel file to the filesystem and then launch excel and the file.

I hope this points you in the proper direction.

Regards,
Dave

On Oct 26, 2009, at 7:51 AM, veena pandit wrote:

Excellent idea! But could you tell me how the servlet fits into my JSF
project.
I have a jsp page that allows the user to select the file. The selected
file is
an xls file and is pulled from the database. I want to show the file as a xls document in a browser(or swing). So if I use your example, how would
I factor it in?  Not sure how to define the navigation rules.

Thanks

On Mon, Oct 26, 2009 at 8:50 AM, David Fisher <[email protected]>wrote:

In Apache Tomcat we have a servlet that does something like this:

public class MyExcelServlet extends HttpServlet {
public void doGet (HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
try {
      response.setContentType("application/vnd.ms-excel" );
      response.setHeader("Content-disposition",
"inline;filename="+filename);
      HSSFWorkbook wb = new HSSFWorkbook();
      // create your workbook using Apache POI
      wb.write(response.getOutputStream());
} catch (Exception e) {

}
}
}

On Oct 26, 2009, at 6:34 AM, @lan Williamson wrote:

That is the bit you are going to have to code up yourself

The purpose of POI is to give you the low-level functions to which to
operate with an EXCEL file.



veena pandit wrote:

Hi,

It looks like all the examples on the page here:

http://poi.apache.org/spreadsheet/examples.html

are examples that produce an excel file.  I need an example
that opens the file as a swing application.or in the browser,
Is there such an example?


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to