-
牧羊人nacy
在页面上写个隐藏域如:<input type="hidden" name="filename" id="filename">然后在script里面给这个隐藏域复值如:document.getElementById("filename").value=document.getElementById("myfile").value;然后在servlet里面取值如:String fileName=request.getParameter("filename");
-
慕婉清6462132
正常取值得到的就是路径+文件名String fileName=request.getParameter("myfile");
-
宝慕林4294392
JSP取得<input type="file"> 文件路径方式如下:1.用request.getParameter(String str)<input type="file" name="fileName">后台用String fileName=request.getParameter("fileName")获取,试试2.直接获取服务器上的内容FileItemFactory factory = new DiskFileItemFactory();ServletFileUpload upload = new ServletFileUpload(factory);List<FileItem> list = upload.parseRequest(request);