Hi I am new to JSP and i am trying to write the below code...
<%@ page import="java.io.*" %>
<%@ page import="com.wipro.assignment2.exceptions.UploadFileNotFoundException" %>
<%
    String requestPath=request.getParameter("file1");
        System.out.println("I am printing before SUBMIT button click");
    if(requestPath!=null)
    {
     File f=new File(requestPath.trim()); 
     System.out.println("Path given to upload : "+requestPath);
     if(!f.exists())
     {
     System.out.println("one");   
      try
      {
       throw new UploadFileNotFoundException("The file trying to upload is not presnt in its path !!!");
      }
      catch(UploadFileNotFoundException filenotfound)
      {
       throw filenotfound;
      }
     }
    }
%>
<html>
<body>
<form  name="form1" method="post"  enctype="multipart/form-data">
    <table align="right">
     <tr>
      <td><A href="index.html">HOME</A></td>
     </tr>
    </table>
    </table>
    <table>
     <tr>
      <td>Select File  </td>
      <td> <input type="file" name="file1"> </td>
     <tr>
      <td><input type="submit" value="Upload"></td>
     </tr>
    </table>
</form>
</body>
</html>
Here in the above code once this JSP page is loaded, before the submit button is being clicked, JSP starts running and if i press the submit button, the request is not passed to the above JSP... Please gimme the idea how it really works..
Thanks in advance