zoukankan      html  css  js  c++  java
  • web server(protein protection )搭建过程中遇到的问题

    1、StringBuffer中append方法有错误

    原因分析:是project默认的JRE系统库和配置的jre不匹配。

    解决方法:项目属性->Add Libray->JRE System Library->Alternate JRE(选择Sun JDK 1.6.0_13)

    2、文件上传问题

    mySmartUpload.setAllowedFilesList("txt");  //设置上传文件类型只能是txt格式

    文件上传处理过程

    • jsp文件:
      <div id="input" align="center" style="900px;">
          <p>Please select file
          <input type="file" name="uploadFile" id="file">
          &nbsp;&nbsp;
      </div>
    • servlet文件:
      PrintWriter out=response.getWriter();
              
              String wrongmessage = "success!";
              SmartUpload mySmartUpload=new SmartUpload();
              mySmartUpload.initialize(config, request, response);
              mySmartUpload.setMaxFileSize(1024*2048);
              //mySmartUpload.setAllowedFilesList("txt");
              
              //bebug
              int j = 0;
              try
              {
                  mySmartUpload.upload();
                  for (int i = 0; i < mySmartUpload.getFiles().getCount(); i++) 
                  {
                      ++j;
                      com.jspsmart.upload.File file = mySmartUpload.getFiles().getFile(i);
                      if (file.isMissing()) 
                          continue;
                  }
              }catch(Exception err)
              {
                  wrongmessage="error in upload " + err.getMessage() + " File:"+j+" in line 251";
                  //out.println("error in upload"+err.getMessage());
                  //allright=false;
                  //return;
              }
              out.print(wrongmessage+" num: " + j);
          }

      3、提示错误,serialVersionUID冲突。

    java.io.InvalidClassException: message.RegisterMessage; local class incompatible: stream classdesc serialVersionUID = 5540404719929042644, local class serialVersionUID = -8915824483106432775

    serialVersionUID的详细介绍:http://www.cnblogs.com/guanghuiqq/archive/2012/07/18/2597036.html

    解决方法:

    如果不想定义它,在Eclipse的设置中也可以把它关掉的,设置如下:        

    Window ==> Preferences ==> Java ==> Compiler ==> Error/Warnings ==>Potential programming problems        

    将Serializable class without serialVersionUID的warning改成ignore即可。

    4、对于一些jar包的问题。

    这里有一个挺全的jar包网址:jar包下载

                                                                                                                                                                   

    2014-09-20

     

    本文内容遵从CC3.0版权协议,转载请注明:转自学而优,思则通

    本文链接地址:web server(protein protection )搭建过程中遇到的问题
    http://www.cnblogs.com/ddblog/
  • 相关阅读:
    browser浏览器类型判断
    泛型函数Func<>
    前台JS端排除重复录入数据方法(取值对比)
    判断字符串是否为空字符串
    Linq语法及用法
    new Array( ) 使用
    性能测试
    [排序N大件之]快速排序
    [排序N大件之]归并排序
    [排序N大件之]谢尔排序
  • 原文地址:https://www.cnblogs.com/ddblog/p/3983023.html
Copyright © 2011-2022 走看看