不明白。你在说什么。
xml,http,xml,jsp没有直接的联系呀。

解决方案 »

  1.   

    不知道,你是怎么给jsp传的数据
    1.如果是通过在url中,如http://community.csdn.net/Expert/topic/3345/3345470.xml?temp=.5123712,则在jsp中直接用request.getParameter("temp")就可以取到参数
    2.如果你给jsp传过来的是一个xml dom,则需在jsp中把他还原为一个dom,可利用jdom来实现。首先从request中取得参数流BufferedReader Stream = request.getReader();然后把这个流一行行的解析成字符串,然后把这个字符串解析成一个jdom的Document对象,以后的操作就简单了。
    3.你可以到网上查一些相关资料。
      

  2.   

    谢谢大家的回复,可能是我没有说明白通过vb建立xmlhttp,如下:
        HttpUpload = False
        XMLhttp.Open "POST", "http://xxx/aa.jsp", False
        XMLhttp.send XMLDoc那么我这个aa.jsp该如何写?
      

  3.   

    哭吧
    上传后,request.getInputStream()得到的是二进制流?还是什么东西?然后怎样转化成文件?并保存?
      

  4.   

    http://blog.csdn.net/gjd111686/archive/2004/08/18/78324.aspx
      

  5.   

    <%
     int iTotalByte,iTotalRead,iReadByte;
     iTotalByte=request.getContentLength(); 
     iTotalRead=0;
     iReadByte=0;
     byte[] Buffer=new byte[iTotalByte];
     if(iTotalByte>0)
     {
      for(;iTotalRead<iTotalByte;iTotalRead+=iReadByte)
      {
       try
       {
    iReadByte=request.getInputStream().read(Buffer,iTotalRead,iTotalByte-iTotalRead);
       }
       catch(Exception e)
       {
        e.printStackTrace();
       }
      }
      String strContentType=request.getContentType();
      //数据处理开始
      String strBuffer=new String(Buffer);
      %><!--<br>表单数据:<br>strBuffer<br>--><%
      String strBoundary="--"+strContentType.substring(strContentType.lastIndexOf("=")+1,strContentType.length());
      String strArray[]=strBuffer.split(strBoundary);  String strSubString;
      int iBegin,iEnd;
      iBegin=0;iEnd=0;
      String strFieldName="";
      String strFieldValue="";
      String strFilePath="";
      String strFileName="";
      String strFileType="";
      boolean bTrue;
      bTrue=false;
      int iLocation=0;
      for(int iIndex=1;iIndex<strArray.length-1;iIndex++)
      {
       strSubString=strArray[iIndex];
       iBegin=strSubString.indexOf("name=\"",0);
       if(iBegin!=-1)
       {
        strFieldName="";strFieldValue="";
        strFilePath="";strFileName="";strFileType="";
        iEnd=strSubString.indexOf("\"",iBegin+6);
        strFieldName=strSubString.substring(iBegin+6,iEnd);
        iBegin=strSubString.indexOf("filename=\"",0);        if(iBegin!=-1)
        {
         bTrue=true;
        }
        iEnd=strSubString.indexOf("\r\n\r\n",0);
        if(bTrue==true)
        {
         //文件路径
         strFilePath=strSubString.substring(iBegin+10,strSubString.indexOf("\"",iBegin+10));strFileName=strFilePath.substring(strFilePath.lastIndexOf("\\")+1);
         strFileType=strSubString.substring(strSubString.indexOf("Content-Type: ")+14,strSubString.indexOf("\r\n\r\n"));
         %><!--<br>文件类型:<br>strFileType<br>--><%
         //文件数据
         iBegin=strSubString.indexOf("\r\n\r\n",iBegin);
         strFieldValue=strSubString.substring(iBegin+4);
         strFieldValue=strFieldValue.substring(0,strFieldValue.lastIndexOf("\n")-1);
         %><!--<br>文件路径:<br>strFilePath<br>文件名称:<br>strFileName<br>--><%
         byte[] pFile=strFieldValue.getBytes();
         byte[] pFileExtend=new byte[pFile.length];
         iLocation=strBuffer.indexOf("filename=\"",iLocation);
         for(int kIndex=iLocation;kIndex<iTotalByte-2;kIndex++)
         {
          if(Buffer[kIndex]==13&&Buffer[kIndex+2]==13)
          {iLocation=kIndex+4;break;}
         }
         for(int nIndex=0;nIndex<pFile.length;nIndex++)
         {
          pFileExtend[nIndex]=Buffer[iLocation+nIndex];
         }
    /*
    //保存到Local Disk;
    FileOutputStream pFileOutputStream=new FileOutputStream("F:\\Site_App\\UploadFile\\"+strFileName);
    pFileOutputStream.write(pFileExtend);
    pFileOutputStream.close();
    */
         session.putValue(strFieldName+"_FileType",strFileType);
         session.putValue(strFieldName+"_FilePath",strFilePath);
         session.putValue(strFieldName+"_FileName",strFileName);
         session.putValue(strFieldName,pFileExtend);
        }
        else
        {
         strFieldValue=strSubString.substring(iEnd+4);
         strFieldValue=strFieldValue.substring(0,strFieldValue.lastIndexOf("\n")-1);
    session.putValue(strFieldName,strFieldValue);
        }
        bTrue=false;
       }
       %><!--<br>表单域名:<br>strFieldName<br>表单域值:<br>strFieldValue<br>--><%
      }
      //数据处理结束
     }
    %>这样(String)session.getValue("表单域名")返回表单域值,而(byte[])session.getValue("File上传控件域名")返回的字节数组就可以用new ByteArrayInputStream(byte[])调用updateBinaryStream来更新到数据库了
      

  6.   

    我这个是通过xmlhttp上传,没有表单,通用嘛?
      

  7.   

    BufferedReader Stream = request.getReader();
                String sline = " ";
                String S = "";
                do
                {
                    if(sline == null)
                        break;
                    sline = Stream.readLine();
                    if(sline != null)
                        S = String.valueOf(String.valueOf(String.valueOf(S))) + String.valueOf(String.valueOf(String.valueOf(sline)));
                } while(true);
                String xml = new String(S.getBytes("ISO-8859-1"), "GB2312");
      

  8.   

    StringReader rSource = new StringReader(xml);
                InputSource insrc = new InputSource(rSource);
                insrc.setEncoding("gb2312");
                Parser.parse(new InputSource(rSource));
                Document doc = Parser.getDocument();
      

  9.   

    生成Document以后,如何解析xml就是jdom的事情了,这个应该还是比较简单的
      

  10.   

    HttpUpload = False
        XMLhttp.Open "POST", "http://xxx/aa.jsp", False
        XMLhttp.send XMLDoc
    ==========================================
    以上你写的程序应该这样写
    HttpUpload = False
        XMLhttp.Open "POST", "http://xxx/aa.jsp?Para='"+param+"'", False
        XMLhttp.send XMLDoc
    在aa.jsp中,你可以用
    request.getParameter("Para")来获得你传递的param参数值,然后你想拿这个(些)参数做什么就是你自己的事了.
      

  11.   

    求助:xmlhttp上传文件,如果文件过大(10M),客户端cpu100就高达100%,是怎么回事?
      

  12.   

    请问你的xmlhttp上传是怎么做的,能给我一份吗?急需,先谢谢。E_mail:[email protected]
      

  13.   

    july_typhoon(加油的风) 的是正解!!
      

  14.   

    不过 july_typhoon(加油的风) 的方法有一个很不好的地方,
    就是他要来个循环Stream.readLine();, 这个是没必要的,可以避免的。
    我的代码://前面你要先 import "java.io.InputStream" InputStream IStream = (InputStream)request.getInputStream();
    int CLength = request.getContentLength();
    byte[] b=new byte[CLength];
    int iRead = IStream.read(b, 0, CLength);
    String xml = new String(b);
    out.println(xml);//字符串xml就是发送来的全部xml内容了。
      

  15.   

    上面的已经可以运行了。
    再改进一下:
    把上面
    int CLength = request.getContentLength();
    改为
    int CLength = IStream.available();