Hi,
I am a complete newbie when it comes to javascript and I need some help. Our
web site creates a text file which I would like the system to ask the user
what to do with, either open, save or cancel. Currently we use the code
below but that only puts it in the browser window and for the text files
that is fine but some of the files are csv and that won't work. If I can't
it to ask me what to do with it, can I force it to open in a new window?
Any and all help, ideas greatly appreciated.
John
<html>
<head>
<link href="/design1.css" type="text/css" rel="stylesheet ">
</head>
<body>
<%
String FileName="";
if (request.getPar ameter("FileNam e")!=null) {
FileName=reques t.getParameter( "FileName").toS tring();
}
String ReportName="Rep ort Viewer";
if (request.getPar ameter("ReportN ame")!=null) {
ReportName=requ est.getParamete r("ReportName") .toString();
}
%>
<%
if (FileName.lengt h()==0) {
%>
<h3>Report Viewer - No report Passed!</h3>
<%
}
else
{
//Got a file name
if (ReportName.len gth()==0) {
out.println("<h 3>Report Viewer</h3>");
}
else {
out.println("<h 3>" + ReportName +
"</h3>");
}
%>
[<a href="<%=FileNa me%>" target="_blank" >Printer
Friendly Format</a>]
[<a href="" onclick='window .print();return false;'[color=blue]
>Print This Page</a>][/color]
<pre>
<jsp:include page="<%=FileNa me%>"/>
</pre>
<%
}
%>
</body>
</html>
I am a complete newbie when it comes to javascript and I need some help. Our
web site creates a text file which I would like the system to ask the user
what to do with, either open, save or cancel. Currently we use the code
below but that only puts it in the browser window and for the text files
that is fine but some of the files are csv and that won't work. If I can't
it to ask me what to do with it, can I force it to open in a new window?
Any and all help, ideas greatly appreciated.
John
<html>
<head>
<link href="/design1.css" type="text/css" rel="stylesheet ">
</head>
<body>
<%
String FileName="";
if (request.getPar ameter("FileNam e")!=null) {
FileName=reques t.getParameter( "FileName").toS tring();
}
String ReportName="Rep ort Viewer";
if (request.getPar ameter("ReportN ame")!=null) {
ReportName=requ est.getParamete r("ReportName") .toString();
}
%>
<%
if (FileName.lengt h()==0) {
%>
<h3>Report Viewer - No report Passed!</h3>
<%
}
else
{
//Got a file name
if (ReportName.len gth()==0) {
out.println("<h 3>Report Viewer</h3>");
}
else {
out.println("<h 3>" + ReportName +
"</h3>");
}
%>
[<a href="<%=FileNa me%>" target="_blank" >Printer
Friendly Format</a>]
[<a href="" onclick='window .print();return false;'[color=blue]
>Print This Page</a>][/color]
<pre>
<jsp:include page="<%=FileNa me%>"/>
</pre>
<%
}
%>
</body>
</html>
Comment