This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSP and the fly likes ******  help needed! on JSP page directives Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "******  help needed! on JSP page directives" Watch "******  help needed! on JSP page directives" New topic
Author

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

sowmya vasisht
Ranch Hand

Joined: Aug 23, 2001
Posts: 35
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

Joined: Mar 22, 2000
Posts: 12761
    
    5
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

Joined: Aug 23, 2001
Posts: 35
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

Joined: Jul 28, 2001
Posts: 260
you can find working example and info in the one of the best books ever:
http://csajsp-chapters.corewebprogramming.com/CSAJSP-Chapter11.pdf
enjoy.


Asher Tarnopolski
SCJP,SCWCD
sowmya vasisht
Ranch Hand

Joined: Aug 23, 2001
Posts: 35
Thanx Asher and William,
The problem is solved
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: ****** help needed! on JSP page directives
 
Similar Threads
Export to Excel Dialog Box Always Pops Up
Web report to Excel attachment in email
Save a JSP page as Word document
Problem in closing the browser
how to download or view the "Excel FILE "i n IE browser