jsp中使用fckeditor2.5.1问题

kuzhu 2008-02-02 12:58:03
jsp中使用fckeditor2.5.1,放在虚拟目录的根目录下没问题可以正常显示,但放到一个子目录中就提示:
Unable to load tag handler class "com.fredck.FCKeditor.tags.FCKeditorTag" for tag "FCK:editor"
同时在Tomcat中报:
2008-2-2 12:52:12 org.apache.jasper.compiler.TldLocationsCache processWebDotXml
警告: Internal Error: File /WEB-INF/web.xml not found

使用fckeditor的jsp文件如下(就只是简单的测试):
=========这是放在虚拟目录的根目录下的文件===============================
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<%@ taglib uri="WEB-INF/FCKeditor.tld" prefix="FCK" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<title>My JSP 'main.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->

</head>

<body>

<FCK:editor id="article" basePath="fckeditor/"
imageBrowserURL="fckeditor/editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector"
linkBrowserURL="fckeditor/editor/filemanager/browser/default/browser.html?Connector=connectors/jsp/connector"
flashBrowserURL="fckeditor/editor/filemanager/browser/default/browser.html?Type=Flash&Connector=connectors/jsp/connector"
imageUploadURL="fckeditor/editor/filemanager/upload/simpleuploader?Type=Image"
linkUploadURL="fckeditor/editor/filemanager/upload/simpleuploader?Type=File"
flashUploadURL="fckeditor/editor/filemanager/upload/simpleuploader?Type=Flash">
</FCK:editor>

</body>
</html>

======================================================================

放到子目录的jsp文件就是把这个文件中的相对目录前都加了"..",如下:

====================放到子目录中的文件=======================================

<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%@ taglib uri="../WEB-INF/FCKeditor.tld" prefix="FCK" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<title>poobBLog后台管理</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->

</head>

<body>

<FCK:editor id="article" basePath="../fckeditor/"
imageBrowserURL="../fckeditor/editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector"
linkBrowserURL="../fckeditor/editor/filemanager/browser/default/browser.html?Connector=connectors/jsp/connector"
flashBrowserURL="../fckeditor/editor/filemanager/browser/default/browser.html?Type=Flash&Connector=connectors/jsp/connector"
imageUploadURL="../fckeditor/editor/filemanager/upload/simpleuploader?Type=Image"
linkUploadURL="../fckeditor/editor/filemanager/upload/simpleuploader?Type=File"
flashUploadURL="../fckeditor/editor/filemanager/upload/simpleuploader?Type=Flash">
</FCK:editor>

</body>
</html>
======================================================================================

请高手看看什么问题,急等中...


...全文
576 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
owen42087743 2008-10-07
  • 打赏
  • 举报
回复
我找到原因了,jar包没有加进去,fckeditor.jar
kuzhu 2008-02-02
  • 打赏
  • 举报
回复
兄弟,我的QQ:398945142 加一下我吧,发贴太慢,不方便,或者你加群:17867343我刚建的,谢谢呀
fengyifei11228 2008-02-02
  • 打赏
  • 举报
回复
使用FCKeditor的项目中的web.xml和FCKeditor.tld联系过于紧密,FCKeditor.tld的默认位置是/WEB-INF/文件夹下,如果修改了FCKeditor.tld的位置,那么需要在web.xml中也作相应的修改。
现在我们在项目中有两个FCKeditor.tld,而在web.xml中引用的是/WEB-INF/文件夹中的FCKeditor.tld,所以会有问题,要不你都改成一个路径,包括在web.xml中的
这样的话比较麻烦啊
尽量还是用默认位置吧
kuzhu 2008-02-02
  • 打赏
  • 举报
回复
对呀,我就是copy到jsp所在的目录的,但还是报相同的错误,第一次碰到,晕了
fengyifei11228 2008-02-02
  • 打赏
  • 举报
回复
可以用绝对路径,把你的FCKeditor.tld所在的路径名全部加入里边就可以了
如果想用<%@ taglib uri="FCKeditor.tld" prefix="FCK" %>也可以,在jsp文件对应的目录中,需要有FCKeditor.tld文件,就是把FCKeditor.tld文件copy到jsp文件所在目录中
kuzhu 2008-02-02
  • 打赏
  • 举报
回复
先谢谢你!
我把FCKeditor.tld放到了放jsp的子目录中,修改为:
<%@ taglib uri="FCKeditor.tld" prefix="FCK" %>
也不行,再请教!!!
fengyifei11228 2008-02-02
  • 打赏
  • 举报
回复
<%@ taglib uri="WEB-INF/FCKeditor.tld" prefix="FCK" %>
<%@ taglib uri="../WEB-INF/FCKeditor.tld" prefix="FCK" %>
在Java项目中,WEB-INF目录的作用就是把不希望别人能访问到的东西放在这个目录(包括子目录下),实现了代码的安全,不担心你辛苦的劳动就别别人EASY的COPY走了。
所以,在程序中是不允许用WEB-INF的父目录什么的,要么你把FCKeditor.tld放到别处,或者使用绝对路径

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧