问个很弱的问题
index.jsp
<%@ page contentType= "text/html; charset=gb2312 " %>
<%@ page language= "java " %>
<form action = "11.jsp " method = "post " enctype= "multipart/form-data " >
<input type = text value= "aa " name = aa>
<input type = submit value = "submit " >
</form>
11.jsp
<%@ page contentType= "text/html; charset=gb2312 " %>
<%@ page language= "java " %>
<%
String aa= request.getParameter( "aa ");
out.print(aa);
%>
为什么我 在 11.jsp 文件里 捕获不到 值呢
而 去掉 form 里的 enctype= "multipart/form-data "
这句 就可以呢 高手 指点
------解决方案--------------------to zhangchao0323()
可以使用jspSmartUpload来实现。
***************************************
用于上传数据的表单:
<form name= "form1 " method= "post " action= "servlet/Upfile " enctype= "multipart/form-data ">
<p> 请输入手机号 </p>
<p>
<input type= "text " name= "phone " value= "1234567890 "/>
</p>
<p> 图片上传(仅现于*.gif和*.jpg文件) </p>
<p>
<input type= "file " name= "file1 "/>
</p>
<p>
<input type= "submit " name= "submit " value= "· 提交 · "/>
</p>
</form>
*************************************************************
提交的后台的servlet
SmartUpload su =new SmartUpload();
su.initialize(this.getServletConfig(), request, response);
String realPath = this.getServletContext().getRealPath( " ");
String path=realPath+ "/images ";
su.setAllowedFilesList( "gif,jpg ");
su.upload();
int count=su.save(path);
msdnid=su.getRequest().getParameter( "phone ");//注意这是接收表单传过来的参数
System.out.println( "msdnid= "+msdnid);
------解决方案--------------------msdnid=su.getRequest().getParameter( "phone ");//注意这是接收表单传过来的参数
这是关键..