I am new to servlets. I want to read document from html form when sumbit
button is pressed.
I am getting only file name, not its content. Andy Bailey, can you help me?
Here is the html and doPost methods I experimented with:
HTML:
<html>
<form action="/servlet/filereading" method="POST" >
Attach File: <input name="sentfile" type="file"> <br>
<input name="send" type="submit">
</form>
</html>
Servlet "doPost" method:
public void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException
{
resp.setContentType("text/html");
PrintWriter out = new PrintWriter(resp.getOutputStream());
out.println("<HTML>");
out.println("<HEAD><TITLE>fileread Output</TITLE></HEAD>");
out.println("<BODY>");
out.println(req.getParameter("sentfile"));
out.println("</BODY>");
out.println("</HTML>");
out.close();
}
Thanks in advance,
venkat
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html