Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

****** help needed! on JSP page directives

 
sowmya vasisht
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSP: How cani conditionally invoke the page content type
my project involves, a report page having 'Save as Excel' and 'Save as HTML' and print hyperlinks when print is clicked a print dialog box is opened thro' window.print() method
in the same manner, when i click on 'Save as Excel' or 'HTML' a dialog box should open and ask for Savin in .xls or .html this happens when i include the page content type at the starting of JSP, but as soon as the page loads the dialog box appears, even if given on some condition.
Is there any other way of invoking the dialog box for Excel or HTML when clicked on hyperlink, in the same JSP.
Please reply ASAP.
thanx in advance,
sowmya
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suspect you are going to have to go to a servlet instead of JSP to generate the Excel content. JSP are really designed for making HTML pages - servlets let you control the response content type and content length.
Bill
[ December 04, 2002: Message edited by: William Brogden ]
[ December 04, 2002: Message edited by: William Brogden ]
 
sowmya vasisht
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI Bill,
Thank you, It was of great help to me...
thanx again,
but, when i did that in servlet,
response.setContentType and response.setHeader..
The dialog box appears when clicked on 'Save as Excel' hyperlink. but when i try to save the contents of the page, it isnot saved , instead a blank excel sheet appears!
Could you please tel me What can I do abt this?
thanx again,
sowmya
 
Asher Tarnopolski
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can find working example and info in the one of the best books ever:
http://csajsp-chapters.corewebprogramming.com/CSAJSP-Chapter11.pdf
enjoy.
 
sowmya vasisht
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx Asher and William,
The problem is solved
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic