<% ..... code to check request is submitted or not ... %> <form method="post" action="" name="uploadform" enctype="multipart/form-data"> <table > <tr> <td>Select up to 3 files to upload</td> </tr> <tr> <td> <input type="hidden" name="newFileName" value="newUploadedFileName1"> <input type="file" name="uploadfile" > </td> </tr> <tr> <td align="center"> <input type="submit" name="Submit" value="Upload"> <input type="reset" name="Reset" value="Cancel"> </td> </tr> </table> </form>
The jsp request code for downloading files will be on the same page above in the% ..%> tag.
How can I add verification using the if statement to check if the Submit button is clicked or not, in other words, whether the mail request is sent or not.
I followed this, http://www.java2s.com/Code/Java/JSP/SubmittingCheckBoxes.htm , but that didn’t help, and this should call another jsp file ("formAction.jsp") on more than one page.
if(request.getParameter("newFileName") != null) {
This instruction always gives null. I do not know why.
Note: this is a form with this attribute => enctype = "multipart / form-data"
If I do not add any if instructions, then the files are downloaded for the first time, but next time, if I press the reload button or refresh the page, the browser will prompt me to resend the data or reload the previous files. I hope you understand the problem. If there is any confusion to understand the problem, please comment.
Can someone give a hint / solution?
source share