I have created two JSP programs as follows.
First One: Addmulti.jsp
<html>
<head><title>Upload Excel File</title></head></p> <p><body>
<form action="Test2.jsp" method="post" enctype="multipart/form-data" name="form1" id="form1">
<br><br>
Upload File:
<input name="file" type="file" id="file"><br><br>
<input type="submit" name="Submit" value="Submit"/><br><br>
<input type="reset" name="Reset" value="Reset"/>
</form>
</body>
</html>
Second one: Test2.jsp
<%@ page import="myfirst.*" %>
<%
String filevar=request.getParameter("file");
String result="";
myfirst.SearchLink z=new myfirst.SearchLink();
result=z.addmultiple(filevar);
System.out.println(result);
out.println(result);
%>
SearchLink is a java program which contains the method as below,
public String addmultiple(String file)throws SQLException{
return file;
}
I want the complete path of the file that is selected in the first jsp program mentioned above to be transmitted to the java method named addmultiple(String). Instead, null is getting printed in the browser as output once the Test2.jsp program is called.
What actually will be passed to the method with the parameter String in the code described above?
How to send the complete path of the file that is selected in the first jsp code to the java program? Please advise.