1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse rep)
throws IOException, ServletException
{
FileReader in = null;
PrintWriter out = null;
rep.setContentType("text/html");
File f = new File("C:/quelquepart/index.html");
try {
// Get an input stream on the form file
in = new FileReader(f);
// Get an output stream for the response
out = rep.getWriter( );
// Write from the input stream to the output stream
char[] buffer = new char[512];
int chars = 0;
while ((chars = in.read(buffer)) != -1) {
out.write(buffer, 0, chars);
}
}
finally {
if (out != null) out.close( );
if (in != null) in.close( );
}
return null;
} |
Partager