I am using the typical form based upload file functionality with servlet like in here http://www.tutorialspoint.com/servlets/servlets-file-uploading.htm
The client side code is
<html>
<head>
<title>File Uploading Form</title>
</head>
<body>
<h3>File Upload:</h3>
Select a file to upload: <br />
<form action="UploadServlet" method="post"
enctype="multipart/form-data">
<input type="file" name="file" size="50" />
<br />
<input type="submit" value="Upload File" />
</form>
</body>
</html>
The problem is that on the server side, I write a json output to the response object (stream). On the client side, it is doing a redirect. Basically , redirecting to a page where it just shows the json output.
On the client side, how can I take control of the respone? I would like to parse the JSON and do something with it but I can't find "the hook" or how to get the output. I am using Javascript and HTML on my client side (and AJAX when possible)
Thank you