如题!

解决方案 »

  1.   

    按照InputStream从流中解析出字符串,在进行分析
      

  2.   

    可以参考网上写的通过getInputStream读取文件的例子,也可以解析Request其他参数的
      

  3.   

    要解析什么,LZ总有自由自己解析的业务规则吧
    用byte数组读出数据,然后根据业务规则,取该byte数组的某一段位置的信息出来分析
      

  4.   

    假如我从客户端上传一个图片文件,然后将它写到response中,不使用上传工具怎样获取此图片数据流
      

  5.   

    三星教你轻松入门手机软件开发,从贫民到富翁,一切都那么简单
    给大家推荐个从销售手机软件致富,并提供手机软件入门学习到开发指导,的“一条龙”服务的三星移动创新者园地:http://innovatorsamsungmobile.com/71
    简单说下我的推荐理由:
    1、3G催生更大规模的软件需求,三星用户达八千九百万,市场份额占第二位。在线商店,手机预装,帮你改进并推销软件,一周挣两万成为可能。
    2、网站教你如何搭建开发环境,全中文安装环境,让你即刻轻松入手。
    3、丰富的入门者学习资料(教程、实例),教你如何写出第一个程序,不用到处搜索资料。
    4、专业手机软件工程师回答你的学习开发问题,快速有水准。
    刚在三星的网站上看到一条消息,苏州的一个朋友已编写出自己的手机软件,已放在三星官方网络商店,两周内的下载量超过3000次,分成有30%。希望朋友们都能借此良机掏到自己的第一桶金。
      

  6.   

    三星教你轻松入门手机软件开发,从贫民到富翁,一切都那么简单
    给大家推荐个从销售手机软件致富,并提供手机软件入门学习到开发指导,的“一条龙”服务的三星移动创新者园地:http://innovatorsamsungmobile.com/71
    简单说下我的推荐理由:
    1、3G催生更大规模的软件需求,三星用户达八千九百万,市场份额占第二位。在线商店,手机预装,帮你改进并推销软件,一周挣两万成为可能。
    2、网站教你如何搭建开发环境,全中文安装环境,让你即刻轻松入手。
    3、丰富的入门者学习资料(教程、实例),教你如何写出第一个程序,不用到处搜索资料。
    4、专业手机软件工程师回答你的学习开发问题,快速有水准。
    刚在三星的网站上看到一条消息,苏州的一个朋友已编写出自己的手机软件,已放在三星官方网络商店,两周内的下载量超过3000次,分成有30%。希望朋友们都能借此良机掏到自己的第一桶金。
      

  7.   

    public static boolean download(HttpServletResponse response, String path, String fileName) throws IOException {
            response.reset();
            response.setContentType("application/x-download");
            String encodefileName = URLEncoder.encode(fileName, "UTF-8");
            response.addHeader("Content-Disposition", "attachment;filename=" + encodefileName); 
            OutputStream outp = null;
            FileInputStream in = null;
            try {
                outp = response.getOutputStream();
                in = new FileInputStream(path);             
    byte[] b = new byte[1024];
                int i = 0;
                try {
                    while ((i = in.read(b)) > 0) {
                        outp.write(b, 0, i);
                    }
                    outp.flush();
                } catch (Exception e) {
                }
            } catch (Exception e) {
                e.printStackTrace();
            } finally {
                if (in != null) {
                    in.close();
                    in = null;
                }
                if (outp != null) {
                    outp.close();
                    outp = null;
                }
            }
            return true;
        }
      

  8.   

    页面上放个文件上传标签
    <input name="theDateFile" id="theDateFile" type="file" value="" style="width:200px">
    你的ActionForm里要用FormFile这个类型
    然后在Action里面就能得到他的流
    InputStreamReader in = form.getTheDateFile().getInputStream();
    这样就得到了流了,剩下的事情就是你愿意怎么搞就怎么搞了
      

  9.   

    当你把要提交的表单的enctype设置为"application/x-www-form-urlencoded"时,在后台将输入流输出到一个文本文件里看看,你将会看到文本格式是"控件name"="用户输入的值",如前台是这样写的:<form action="../writeStream.do" method="post" enctype="application/x-www-form-urlencoded">
    <input type="text" name="myTest" id="myTest">&nbsp;
            <input type="text" name="myTest">nbsp;
    <input type="submit" name="submit" value="上传" id="submit">
    </form>在第一个文本框中输入"test",在第二个文本框中输入"yeah",那么那个文本文件内容是:myTest=test&myTest=yeah&submit=%E4%B8%8A%E4%BC%A0
    当然,你若把enctype设置为"multipart/form-data",则按照这样的操作话会出现下面的文本:
    -----------------------------7d91a5d1a064a
    Content-Disposition: form-data; name="myTest"test
    -----------------------------7d91a5d1a064a
    Content-Disposition: form-data; name="myTest"yeah
    -----------------------------7d91a5d1a064a
    Content-Disposition: form-data; name="submit"上传
    -----------------------------7d91a5d1a064a--格式与前面的情况相差很远,我猜那些JAVA下载工具就是分析这些文本来达到想要的功能的.
    我的后台代码如下:import java.io.BufferedOutputStream;
    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.InputStream;import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;public class RequestInputStreamTest extends Action {
    @Override
    public ActionForward execute(ActionMapping mapping, ActionForm form,
    HttpServletRequest request, HttpServletResponse response)
    throws Exception {
    InputStream in = request.getInputStream();
    File file = new File("d:/inputStream.txt");
    if(!file.exists()){file.createNewFile();}
    FileOutputStream out = new FileOutputStream(file);
    BufferedOutputStream bufOut = new BufferedOutputStream(out);
    byte[] b = new byte[2];
    while(in.read(b) != -1){
    bufOut.write(b);
    }
    bufOut.flush();
    bufOut.close();
    out.close();
    return null;
    }
    }