SpringMVC UEditor

之前理解的一些误区:

1.所有的富文本功能都有一个插件

   因为每个富文本显示的内容不一样,所以不建议使用统一的 js.

2. 写一个共通的controller用来给UEditor调用

  这个样子不大好啊,还是各自管各自的吧,编辑器里用路径的地方太多了。

3. config.json 的路径问题:

  ConfigManager类中getConfigPath 是获取config.json的路径,如果每个功能保存的不一样还是改各自的吧。

4.总之各个功能用各自的UEdito配置。

5.最好还是用debug调试源码,看看。


自己记住的几个点:

1.ueditor.config.js

    var URL = webRoot;
    
    // 这个是ueditor插件在服务上的路径:http://localhost:8080/js/plugins/ueditor/
    UEDITOR_HOME_URL: URL + "/js/plugins/ueditor/" 
    // 这个是自己配置的Controller的路径(写到要实现富文本编辑器的那个controller里)
    serverUrl: URL + "/system/remind/ueditor"

@RequestMapping("/ueditor")
public void config(HttpServletRequest request, HttpServletResponse response) {
    // response.setContentType("application/json");
    String rootPath = request.getSession().getServletContext().getRealPath("/jsp");
    response.setHeader("Content-Type", "text/html");
    try {
        String a = request.getRequestURI();
        String exec = new ActionEnter(request, rootPath).exec();
        PrintWriter writer = response.getWriter();
        writer.write(exec);
        writer.flush();
        writer.close();
    } catch (IOException e) {
        e.printStackTrace();
    }
}
String rootPath = request.getSession().getServletContext().getRealPath("/jsp");
为什么要加上 /jsp 因为:mvc.xml中 
viewResolvers 的 <property name="prefix" value="/jsp/" /> 这个jsp





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值