科室管理系统中,运用百度编辑器(ueditor1_4_3-utf8-jsp)出现的一系列问题!

1.首先下载ueditor1_4_3-utf8-jsp并解压,下载地址:http://ueditor.baidu.com/website/download.html
2,在MyE clipse里新建一个 hnzhy项目(我新建的项目为hnzhy),建好项目后,会有一个WebRoot文件夹,在此目录下新建文件夹ueditor1_4_3,
然后把解压的ueditor1_4_3-utf8-jsp目录下的所有文件都复制到新建文件夹ueditor1_4_3下
如下图所示:

3,在index.jsp中配置引用ueditor:



4,把ueditor1_4_3-utf8-jsp\jsp\lib下的jar包复制到WebRoot/WEB-INF/lib下(注意jar包冲突),如下图:


5.,打开ueditor1_4_3/jsp/config.json文件:修改图片访问路径前缀imageUrlPrefix的值为符合项目访问的值,如下图:

6.修改ueditor1_4_3/ueditor.config.js的window.UEDITOR_HOME_URL为符合项目访问的路径,如下图:

7. 在ueditor1_4_3/ueditor.config.js中也可修改编辑器的大小,如下图:

8.在tomcat中启动项目后,输入地址http://localhost:8080/UeditorDemo/index.jsp就会出现编辑器,选择图片上传按钮即可上传图片,


注意:
一:如果在java项目中引入百度编辑器时,百度编辑器不显示的话,则可以看看jsp引入js和css路径,如下图:


二:在SSH框架中可能上传图片时,会报错:未找到上传数据,解决办法如下:

1.新建立一个过滤器filter
public class UeditorFilter extends StrutsPrepareAndExecuteFilter {
	 public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
		  HttpServletRequest request = (HttpServletRequest) req;
		  String url = request.getRequestURI();
		  if (url.endsWith("controller.jsp")) {
		   chain.doFilter(req, res);
		  }
		  // 拦截使用默认的拦截
		  else {
		   super.doFilter(req, res, chain);
		  }
	 }
}
编写过滤器,对ueditor中的controller.jsp不进行Struts2的过滤,如上代码:
2.配置web.xml
<filter>
	  <filter-name>struts2</filter-name>
	  <filter-class>cn.edu.hactcm.hnzhy.filter.UeditorFilter</filter-class>
 	</filter>
	<filter-mapping>
	  <filter-name>struts2</filter-name>
	  <url-pattern>/*</url-pattern>
	</filter-mapping>
	
	<welcome-file-list>
	  <welcome-file>index.jsp</welcome-file>
	</welcome-file-list>

这样即可!



  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值