copy file on client system

hello,

i got the following problem.

on my jsp there is a button which should open a winword document, not in the browser, instead using the winword.exe.

therefore the doc file must be copied to the client system. and winword must be executed to open the file.

i got some code, to execute winword and open a file.

but how:

- can i copy the file to the client system

- execute the code on the client to start winword

[464 byte] By [SaschaJanza] at [2007-11-26 14:34:14]
# 1

Usually this is done by setting the content type to "application/msword"

<%@ page import="java.util.*" %>

<%@ page import="java.io.*" %>

<%@ page session="false" buffer="1kb" contentType="application/msword" ; charset=ISO-8859-1" %>

<%! int offSet = 100; %>

<%

String back = request.getParameter("back");

String filename = request.getParameter("filename");

Filefile = null;

if (filename != null) {

file = new File(filename);

}

if ((file == null) || (! file.exists()) || (! file.canRead())) {

response.setContentType("text/html ; charset=ISO-8859-1");

out.println("<HTML>");

out.println("<head>");

out.println("<title>Tail Log File: ");

out.println(request.getParameter("filename"));

out.println("</title>");

out.println("</head>");

out.println("<BODY>");

if (back != null) {

out.print("<a href=\"");

out.print(request.getParameter("back"));

out.print("\">back</a>

");

}

out.println("Unable to access log file ");

out.println(filename);

out.println("</BODY></HTML>");

return;

}

BufferedReader br = null;

BufferedWriter bw = null;

try {

br = new BufferedReader(new FileReader(file));

String line = "";

bw = new BufferedWriter(new OutputStreamWriter(response.getOutputStream()));

while ((line = br.readLine()) != null) {

bw.write(line);

bw.newLine();

}

} catch (Exception e) {

e.printStackTrace();

} finally {

if (br != null) {

try {

br.close();

} catch (Exception e) {

// nop

}

}

if (bw != null) {

try {

bw.close();

} catch (Exception e) {

// nop

}

}

}//End finally

%>

tolmanka at 2007-7-8 2:30:19 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...