首页 > Web开发 > 详细

web server(protein protection )搭建过程中遇到的问题

时间:2014-09-20 11:08:18      阅读:305      评论:0      收藏:0      [点我收藏+]

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="width: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即可。

                                                                                                                                                               

2014-09-20

 

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

本文链接地址:web server(protein protection )搭建过程中遇到的问题

web server(protein protection )搭建过程中遇到的问题

原文:http://www.cnblogs.com/ddblog/p/3983023.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!