问题描述
目录结构WebRoot |-ckeditor |-css |-image |-js |-WEB-INF |-lib |-pages |-acticles |-addArticles.jsp |-index.jsp |-MyJsp.jspMyJsp.jsp 中的的代码 与 addArticles.jsp 中的代码完全一致! 核心代码:<form action="sample_posteddata.jsp" method="get"><p><label for="editor1">Editor 1:</label><textarea cols="80" id="editor1" name="editor1" rows="10"></textarea></p><p><input type="submit" value="Submit" /></p></form><ckeditor:replace replace="editor1" basePath="ckeditor/" />前台访问MyJsp.jsp 一切正常! 通过 spring mvc 访问 addArticles.jsp 就报错lang.contextmenu.options 为空或不是对象!ckeditor.js怀疑是路径的问题,是否跟spring mvc 配置访问静态资源有关! 求指点!附 wen.xml 配置:<?xml version="1.0" encoding="UTF-8"?><web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns="http://java.sun.com/xml/ns/javaee"xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"id="WebApp_ID" version="2.5"><display-name>myqzone</display-name><welcome-file-list><welcome-file>index.jsp</welcome-file></welcome-file-list><servlet><servlet-name>spring</servlet-name><servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class><load-on-startup>1</load-on-startup></servlet><servlet-mapping><servlet-name>spring</servlet-name><url-pattern>/</url-pattern></servlet-mapping><servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.css</url-pattern></servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.gif</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.jpg</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.js</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.png</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.txt</url-pattern> </servlet-mapping></web-app>
解决方案
<servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>这里</url-pattern> </servlet-mapping>建议:1. 先去掉spring mvc的过滤. <url-pattern>/</url-pattern> 先把这里改为指定后缀访问测试. 如果没问题的话 证明是过滤的问题. 然后检查fck下面的文件后缀 都添加到web.xml中. 2. 如果去掉spring mvc的过滤后还是不能访问的话.. 那就检查其它的地方吧.