• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

JSF database to excel

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi ,
I want make a small project in JSF in which I will feed all the values in database to be fed to an excel sheet . Right now I can connect to the database and show up all the values in JSP pages but how to take it to excel like client-machine user will just click a button and whole thing of the database will be downloaded as an excel sheet.

 
Saloon Keeper
Posts: 28108
198
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There isn't anything such as a "JSF database". JSF apps can use databases (or not), but JSF itself doesn't get involved with databases.

One of the simplest ways to output an Excel spreadsheet is to format a CSV text file and set the MIME type of the output to "excel". I don't remember the exact value, but it's going to look roughly like "x-application/vnd-xls" or something of that sort. The output itself won't be an XLS file, but Excel will automatically know what to do with a CSV file.

If you actually want to output something in "Excel" format - whether it's traditional XLS or XML XML, you need some heavyweight support. The Apache Poi project is good for that.

In either event, JSF is designed to output HTML, and neither of the 2 "Excel formats" nor CSV are HTML. So you're better off using a servlet or JSP to do the Excel output. Since JSF session-scope beans are actually just ordinary Servlet session objects, you can do your data entry using JSF to edit a session object (backing bean), then have your display servlet/JSF reference that session object to produce the output.
 
Your mind is under my control .... your will is now mine .... read this tiny ad
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic