ueditor+SSH+weblogic+war使用总结
做这个项目时主要发现的问题是图片的上传路径的事
1.在ueditor完整配置项(editor_config.js)中添加window.UEDITOR_HOME_URL = "/项目名/ueditor/";
2.在web.xml中struts2的过滤器中配置加入红字部分,不然传入后台的request请求将改变,使上传图片失败
<!-- 通过filter配置struts2 -->
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/page/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
|
3.建立weblogic虚拟目录,目录名可以修改weblogic.xml中path
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app">
<session-descriptor>
<cookie-name>JSESSIONID1</cookie-name>
</session-descriptor>
<virtual-directory-mapping>
<local-path>picUpload</local-path>
<url-pattern>/*</url-pattern>
</virtual-directory-mapping>
</weblogic-web-app>
|
4.在editor_config.js中添加war虚拟目录路径
//获取当前网址,如: http://localhost:8083/uimcardprj/share/meun.jsp
var curWwwPath=window.document.location.href;
//获取主机地址之后的目录,如: uimcardprj/share/meun.jsp
var pathName=window.document.location.pathname;
var pos=curWwwPath.indexOf(pathName);
//获取主机地址,如: http://localhost:8083
var localhostPaht=curWwwPath.substring(0,pos);
var rootPath = localhostPaht + "/ueditor/";
//修改URL为roolPath
imagePath : rootPath + "jsp/"
|
5.修改Upload.java中的getPhysicalPath方法
private String getPhysicalPath(String path) {
//String servletPath = this.request.getServletPath();
//String realPath = this.request.getSession().getServletContext().getRealPath(servletPath);
//return new File(realPath).getParent() +"/" +path;
return new File("ueditor/jsp") +"/" +path;
}
|
6.修改getRemoteImage.jsp中
//String str = application.getRealPath(request.getServletPath());
String str = "ueditor/jsp";
|
到此本地上传图片可以正常使用,但是在线管理还不能使用。
7.修改imageManager.jsp中
public String getRealPath(HttpServletRequest request,String path){
//ServletContext application = request.getSession().getServletContext();
//String str = application.getRealPath(request.getServletPath());
Stringstr = "ueditor/jsp/upload";
return new File(str).getParent();
}
|
8.在editor_config.js中添加war虚拟目录路径,并修改
catcherPath : rootPath + "jsp/" // 图片修正地址,同imagePath;远程图片抓取参数
imageManagerPath : rootPath + "jsp/" // 图片修正地址,同imagePath
|
至此百度富文本编辑器总算是能用了!附贴图
.1上传成功

.2插入文本框样式

到此在线管理还未成功,哪位大侠知道请补充一下!