• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

jsp to excel

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hai
I found following code working.
<%@ page contentType="application/vnd.ms-excel" %>
<% out.println("bala"+"\t"+"chidambaram"); %>

like this can i place variables( rs.getString(1) ) read from database instead of string contants(bala,chidambaram).
suggestions are welcome
thank u.
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your browser will try to treat the output like an XLS file and use Excel to render it.
If Excel can't understand what you're sending, it will not render it correctly and/or give errors.
It's up to you to format the output correctly. CSV format works for simple data, SLK for more complex stuff.
Or you may want to look at packages like POI to generate binary Excel data and try to send that.
IMO you'd better not use a JSP to generate Excel data, a servlet (possibly using an XSL transformation or Jython script) is far better suited.
 
reply
    Bookmark Topic Watch Topic
  • New Topic