各位大侠:
我在第一个jsp页面的form属性中设置了enctype="multipart/form-data"属性,并设置了一个hidden name为projectid value为00001.form 提交到下一jsp页面.
但在下一jsp页面中用request.getParameter("projectid")取得的值,为空.
请教解决的方法.
谢谢
我在第一个jsp页面的form属性中设置了enctype="multipart/form-data"属性,并设置了一个hidden name为projectid value为00001.form 提交到下一jsp页面.
但在下一jsp页面中用request.getParameter("projectid")取得的值,为空.
请教解决的方法.
谢谢
这个一般是文件上传用的
> 1. download
> http://jakarta.apache.org/commons/sandbox/fileupload/
> 2. invoke readHeaders() in
> org.apache.commons.fileupload.MultipartStreamThe Solution B as given by my dear friend is a bit hectic and a bit complex :(
We can try the following solution which I found much simpler (at least in usage).1. Download one of the versions of UploadFile from http://jakarta.apache.org/commons/fileupload/
2. Invoke parseRequest(request) on org.apache.commons.fileupload.FileUploadBase which returns list of org.apache.commons.fileupload.FileItem objects.
3. Invoke isFormField() on each of the FileItem objects. This determines whether the file item is a form paramater or stream of uploaded file.
4. Invoke getFieldName() to get parameter name and getString() to get parameter value on FileItem if it's a form parameter. Invoke write(java.io.File) on FileItem to save the uploaded file stream to a file if the FileItem is not a form parameter.
你找一下jsp的那个上传组件吧,很好用的
如jspsmartupload
里边提供了得到表单数据的方法
属性一般是上传文件的时候用到,这里根本没必要用
MultipartRequest multi=new MultipartRequest(request,saveDirectory,maxPostSize,enCoding);
String textfbnew=multi.getParameter("textfbnew");
这样就可以得到前个页面的值了