<html>
  <head>
<script type="text/javascript" src="Js/special.js"></script>

<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
<script src="ckeditor/_samples/sample.js" type="text/javascript"></script>
<link href="ckeditor/_samples/sample.css" rel="stylesheet" type="text/css"/> </head>
 <body>
   ......
</body>
</html>
  以上是我的一个导入了CKEDITOR文本编辑器的页面,单独页面的时候ckeditor的样式和JS都能引用的到,但是经由别的页面的button点击后跳到这个页面时,发现ckeditor的样式都没有了,以为是路径的问题,想修改成绝对路径,但是不太会,自我修改后,单独页面也无法加载出ckeditor了。请各位大侠指教
----------------------------------------------------------------------------------------------------------
修改后的
<html>
  <head>
<script type="text/javascript" src="Js/special.js"></script>

<script type="text/javascript" src="${pageContext.request.contextPath}/ckeditor.js"></script>
<script src="${pageContext.request.contextPath}/sample.js" type="text/javascript"></script>
<link href="${pageContext.request.contextPath}/sample.css" rel="stylesheet" type="text/css"/> </head>
 <body>
   ......
</body>
</html>

解决方案 »

  1.   

    <script src="<%=cp%>/ckeditor/ckeditor.js" type="text/javascript"> </script> 
    参考
      

  2.   

    楼上的<script src=" <%=cp%>/ckeditor/ckeditor.js" type="text/javascript"> </script> 你这里的cp是什么?不明白,起什么作用
      

  3.   

    <%=cp%>JSP标签,应该是获得的jsp自动生成的path路径
      

  4.   

    用绝对路径吧。
    <script type="text/javascript" src="/yourApp/ckeditor/ckeditor.js"> </script> 
    ckeditor放在与WEB-INF平行的路径下。
      

  5.   


    <script src="<%=request.getContextPath()%>/ckeditor/_samples/sample.js" type="text/javascript"> </script>
      

  6.   

    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %>
    <html>
      <head>
    <script type="text/javascript" src="<%=path%>/Js/special.js"></script>

    <script type="text/javascript" src="<%=path%>/ckeditor/ckeditor.js"></script>
    <script src="<%=path%>/ckeditor/_samples/sample.js" type="text/javascript"></script>
    <link href="<%=path%>/ckeditor/_samples/sample.css" rel="stylesheet" type="text/css"/> </head>
      <body>
    谢谢各位大侠的提醒和帮忙,经小弟测试,以上这种方法可以保证在页面跳转的时候依然能够加载到CKeditor的js和css样式。再次感谢大家~!