100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > 解决ueditor百度富文本编辑器图片可以上传但是管理图片无法显示

解决ueditor百度富文本编辑器图片可以上传但是管理图片无法显示

时间:2024-06-16 15:40:37

相关推荐

解决ueditor百度富文本编辑器图片可以上传但是管理图片无法显示

1.

在controller.jsp的文件里面 替换掉之前的java代码 也就是<% %>里面的

修改为下面这个代码

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.

配置config.json文件

在 /* 列出指定目录下的图片 */

"imageManagerActionName": "listimage", /* 执行图片管理的action名称 */

"imageManagerListPath": "/ueditor/jsp/upload/image/", /* 指定要列出图片的目录 */

"imageManagerListSize": 20, /* 每次列出文件数量 */

"imageManagerUrlPrefix": "/把这改为你自己的项目名称即可", /* 图片访问路径前缀 */

"imageManagerInsertAlign": "none", /* 插入的图片浮动方式 */

"imageManagerAllowFiles": [".png", ".jpg", ".jpeg", ".gif", ".bmp"], /* 列出的文件类型 */

修改imageManagerUrlPrefix为你自己的项目名称:/

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。