5. UEditor 完善 图片在线管理 问题

内容概述:解决图片上传正常但在管理界面不显示的问题,涉及JSP编码设置和ueditor中文件路径处理的代码修改。

问题 : 图片能够正常上传,正常显示,但是在线管理那里的图片显示不了。

  1. 如图:

  2. 解决方法:

    1. 修改 jsp/controller.jsp 的代码

      1. 修改前:

            request.setCharacterEncoding( "utf-8" );
        	response.setHeader("Content-Type" , "text/html");
        	
        	String rootPath = application.getRealPath( "/" );
        	
        	out.write( new ActionEnter( request, rootPath ).exec() );
        
      2. 修改为:

            request.setCharacterEncoding( "utf-8" );
        	response.setHeader("Content-Type" , "text/html");
        	
        	String rootPath = application.getRealPath( "/" );
        	
        	String action = request.getParameter("action");  
        	String result = new ActionEnter( request, rootPath ).exec();  
        	if( action!=null &&   
        	   (action.equals("listfile") || action.equals("listimage") ) ){  
        	    rootPath = rootPath.replace("\\", "/");  
        	    result = result.replaceAll(rootPath, "/");  
        	}   
        	out.write( result );
        
    2. 修改 ueditor源码中 FileManager.java 的代码

      1. 修改前:

        private String getPath ( File file ) {
            String path = file.getAbsolutePath();
            return path.replace(this.rootPath, "" );
        }
        
      2. 修改为

        private String getPath ( File file ) {
            String path = PathFormat.format(file.getAbsolutePath());
            return path.replace(this.rootPath, "" );
        }    
        
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值