借花献佛:
:)String contentType = request.getContentType();
if(contentType != null && contentType.startsWith("multipart/form-data")){
InputStream in = request.getInputStream();
ByteArrayOutputStream buf = new ByteArrayOutputStream();
int data = -1;
int size = 0;
while((data = in.read()) > -1)
{
  buf.write(data);
}
//use buf as OutputStream on your server side}

解决方案 »

  1.   

    你是用什么实现上传的,如用jspsmartupload,可以这样
     <jsp:useBean id="mySmartUpload" scope="page" class="com.jspsmart.upload.SmartUpload"/>  txttitle=mySmartUpload.getRequest().getParameter("texttitle").trim();
      

  2.   

    楼上的方法没有试过,不过有一种更方便的方法:
    把你要传的参数放到Url里
    比如:a4.jsp?par1='..'&par2='..'
    这样就可以取了!
      

  3.   

    就是syuhans(S玉涵S)那么写的啊。
    <input type=text name="texttitle"> 
    -->
    txttitle=mySmartUpload.getRequest().getParameter("texttitle").trim();
      

  4.   

    to  utirei(雨无声) :
                        根本不可能取到的,因为encType="multipart/form-data形式,它是流的形势,根本不能通过getParameter("texttitle")取到中文值的!
      

  5.   

    before you write :
    txttitle=mySmartUpload.getRequest().getParameter("texttitle").trim();you must write :
    mySmartUpload.upload(); before it first.
      

  6.   

    and chinese character has no problem at all.SmartUpload will resolve it automaticly.
    and if you read the source code ,you will know the method upload() is to parth the stream,so no matter what you want to do with SmartUpload, use it first.
      

  7.   

    to  Fortune2k1:
                  我用在上型机上,com.jspsmart.upload.SmartUpload up=new com.jspsmart.upload.SmartUpload();
    com.jspsmart.upload.Request qs = null;
    try
    {
    up.setMaxFileSize(200*1024*1024); //最大上传文件2M
    up.init(config);
    up.service(request,response);
    up.upload();
    qs=up.getRequest();
    }
    catch(Exception e)
    {
    String err=Function.ToString(e.getMessage());
    if(err.indexOf("Size exceeded for this file")!=-1)
    {
    out.println("<script>alert('文件太大了,请控制在2M以内!')</script>");
    }
    } 我也是像你所写的用upload()在先,根本取不到其它文本框的中文值(非中文的是可以取到的)我要实现的jsp页面就是一个回复文本框 + 可以上传一个附件的功能!
     这个问题实在太烦了!
      

  8.   

    in servlet:do post
    SmartUpload mySmartUpload = new SmartUpload();
    mySmartUpload.initialize(config,request,response);
    mySmartUpload.upload();
    String fileCategory = (mySmartUpload.getRequest().getParameter("fileCategory")==null)?"":mySmartUpload.getRequest().getParameter("fileCategory").toString() ;the above code has no problem in my computer when running in weblogic 7.
    And chinese character also can be got correctly.
    So I think maybe there are some other questions with your code which are not involved with SmartUpload.
      

  9.   

    <jsp:useBean id="upload" scope="page" class="com.jspsmart.upload.SmartUpload" />
    <%
    upload.initialize(pageContext);
    upload.upload();
    java.util.Enumeration e = upload.getRequest().getParameterNames();
    while(e.hasMoreElements()){
     String fieldname = (String)e.nextElement();//取文本框或是其他控件的名称
     String fieldvalue = upload.getRequest().getParameterValues(fieldname);//取对应值
    }
    %>
      

  10.   

    上面写错了
    String fieldvalue = upload.getRequest().getParameterValues(fieldname);
    应该是
    String[] fieldvalue = upload.getRequest().getParameterValues(fieldname);
    返回的是数祖类型的