| 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: 12267
|
|
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 ]
|
Java Resources at www.wbrogden.com
|
 |
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
|
 |
 |
|
|
subject: ****** help needed! on JSP page directives
|
|
|