<url-pattern>本来就是指一个把请求的路径映射到serlet上面,并不是指一个实际路径啊。看最上面的错误,你把
 <url-pattern>/FCKeditor/editor/filemanager/browser/default/connectors/jsp/connector </url-pattern>
  

改成<url-pattern>/connectors/jsp/connector </url-pattern>看看?

解决方案 »

  1.   

    谢谢!!试了一下,,仍然提示那样的错误..,FCKditor所带的其它文件是不是也要修改啊。。
      

  2.   

    可能是FCK用的是servlet上傳文件的。而在struts2中你用了他的上傳功能。當表單中有文件流的時候,Struts就處理了。沒有用到servlet來上傳。建議重新寫一下那個上傳文件的類。改為用struts上傳便可。
      

  3.   

    剛好開到有一個,貼一個給你。package com.fredck.FCKeditor.uploader;import java.io.BufferedInputStream;
    import java.io.BufferedOutputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.Calendar;import org.apache.struts2.ServletActionContext;
    import com.opensymphony.xwork2.ActionSupport;public class Struts2Upload extends ActionSupport{

    /**
     * 
     */
    private static final long serialVersionUID = -3255950564689029065L;
    private File txtUrl2;
    private String fileName;
    private String reFileName;

    private static final int BUFFER_SIZE = 16*1024 ;

    public String upload(){
    //upload File        
            if(!(this.getTxtUrl2().length()==0)){
                String y = getYear();
                String m = getMONTH();                  
                reFileName = y + "/" + m + "/" + changeFileNameByRandom(getExtention(this.fileName));
                CreatFolder(ServletActionContext.getServletContext().getRealPath("") + "\\UserFiles\\" + y + "\\" + m);                    
                File f = new File(ServletActionContext.getServletContext().getRealPath("") + "\\UserFiles\\" + reFileName );
                copy(this.getTxtUrl2(), f);
                
                return SUCCESS;
            }else{
             return ERROR;
            }
    } public File getTxtUrl2() {
    return txtUrl2;
    } public void setTxtUrl2(File txtUrl2) {
    this.txtUrl2 = txtUrl2;
    }
    public void setTxtUrl2FileName(String fileName){
            this .fileName = fileName;
        }
    @SuppressWarnings("unused")
        private static void copy(File src, File dst)  {
            try{
               InputStream in = null ;
               OutputStream out = null ;
                try{
                   in = new BufferedInputStream( new FileInputStream(src), BUFFER_SIZE);
                   out = new BufferedOutputStream( new FileOutputStream(dst), BUFFER_SIZE);
                    byte [] buffer = new byte [BUFFER_SIZE];
                    while (in.read(buffer) > 0 )  {
                       out.write(buffer);
                   } 
                }finally{
                    if( null != in){
                       in.close();
                   } 
                     if ( null != out){
                       out.close();
                   }
               } 
            } catch (Exception e){
               e.printStackTrace();
           } 
        }
    @SuppressWarnings("unused")
        private static String getExtention(String fileName)  {
            int pos = fileName.lastIndexOf( "." );
            return fileName.substring(pos);
        }

    public String getYear(){
            Calendar calendar = Calendar.getInstance();
            return String.valueOf(calendar.get(Calendar.YEAR));
        }
        
        public String getMONTH(){
            Calendar calendar = Calendar.getInstance();
            return String.valueOf(calendar.get(Calendar.MONTH)+1);
        }
        public String changeFileNameByRandom(String filename){
            Calendar calendar = Calendar.getInstance();
            String [] fn = filename.trim().split("\\.");
            filename = String.valueOf(calendar.get(Calendar.YEAR))
            + String.valueOf((calendar.get(Calendar.MONTH)+1))
            + String.valueOf(calendar.get(Calendar.DATE))
            + String.valueOf(calendar.getTimeInMillis());
            if(fn.length == 1){
                return filename;
            }else{
                return filename + "."+fn[fn.length -1];
            }
        } public String getFileName() {
    return fileName;
    } public void setFileName(String fileName) {
    this.fileName = fileName;
    }

    public void CreatFolder(String foldername){
            File thePath = new File(foldername);   
            if(thePath.isDirectory() == false){
                thePath.mkdirs();            
            }        
        } public String getReFileName() {
    return reFileName;
    } public void setReFileName(String reFileName) {
    this.reFileName = reFileName;
    }
    }
      

  4.   

    谢谢你的回答,,可是我用的是strut1.2的也会出现这种现象吗!!
    另外,我是初学.你给的这个类是不是直接考进去就行了.还是要进行其它的相关的配置?!
      

  5.   

    XML解析的问题,以前我遇到过!
    下载xalan-j_2_7_0-bin.zip,放到lib目录下就没问题了。

      

  6.   

    XML解析的问题,以前我遇到过!
    下载xalan-j_2_7_0-bin.zip,放到lib目录下就没问题了。