i want to web app that takes in a pdf file and displays it but i got a http 500 error.i thought it was get extracting the byte array from the request and adding it to the response output stream. well where was i wrong?
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.getOutputStream().write(request.getParameter("f").getBytes());
response.getOutputStream().flush();
response.getOutputStream().close();
}
here is the html page
<body>
<form action="display" method="post" enctype="multipart/form-data">
PDF FILE : <input type="file" name="f">
<input type="submit" value="display">
</form>
</body>
here is the error that i got
java.lang.NullPointerException
display.doPost(display.java:43)
javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722