test.jsp
<form action="test1.jsp"  name="form1"">
  <p>
   
    <input type="file" name="filepath" />
</p>
  <p>
    <input type="submit" name="Submit" value="提交" />
</p>
------------------------------------------------------------
test1.jsp
<%! String file_path;%>
<%file_path = request.getParameter("filepath");
out.println(file_path);
%>我想通过以上的文件域来取到文件的路径,但是取到的值是NULL,请高手帮帮忙!!!!

解决方案 »

  1.   

    以下是我修改过的代码,测试后,可以得到值。请参考。
     
    <%
        String file_path;
        file_path = request.getParameter("filepath");
        System.out.println(file_path);
        %>
        <form action=""  name="form1">
                <p><input type="file" name="filepath"/></p>
          <p>
            <input type="submit" name="Submit" value="提交" />
        </p>
        </form>