??xml version="1.0" encoding="utf-8" standalone="yes"?>超碰在线国产,久久久国产亚洲精品,日韩精品国内http://www.aygfsteel.com/zhouf/category/45703.htmlzh-cnSun, 25 Jul 2010 15:37:24 GMTSun, 25 Jul 2010 15:37:24 GMT60CKeditor3.3配置记录http://www.aygfsteel.com/zhouf/articles/322282.htmlZhouFengZhouFengSun, 30 May 2010 16:30:00 GMThttp://www.aygfsteel.com/zhouf/articles/322282.htmlhttp://www.aygfsteel.com/zhouf/comments/322282.htmlhttp://www.aygfsteel.com/zhouf/articles/322282.html#Feedback2http://www.aygfsteel.com/zhouf/comments/commentRss/322282.htmlhttp://www.aygfsteel.com/zhouf/services/trackbacks/322282.html阅读全文

ZhouFeng 2010-05-31 00:30 发表评论
]]>
搞定FCKeditor2.6.4上传中文囄的问?/title><link>http://www.aygfsteel.com/zhouf/articles/279808.html</link><dc:creator>ZhouFeng</dc:creator><author>ZhouFeng</author><pubDate>Wed, 03 Jun 2009 06:41:00 GMT</pubDate><guid>http://www.aygfsteel.com/zhouf/articles/279808.html</guid><wfw:comment>http://www.aygfsteel.com/zhouf/comments/279808.html</wfw:comment><comments>http://www.aygfsteel.com/zhouf/articles/279808.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/zhouf/comments/commentRss/279808.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/zhouf/services/trackbacks/279808.html</trackback:ping><description><![CDATA[昨天配置好了FCKeditor,可以上传囄和文件了,可有一个问题还没有解决,那就是上传中文图片的时候会出现q,我的工程里用的编码都是UTF-8?在网上找了好些资?都搞不定,最后下载了<a >fckeditor-java-2.4.1-src.zip</a>(在http://www.fckeditor.net/download上也有下?.解压~之?把源文g部v到工E里,可启动老是报错,不知道是啥回事儿,后来换成了手动的,操作如下<br /> 扑ֈ源文件中?net.fckeditor.connector.ConnectorServlet.java,其中的部分代码Ҏ,我们先搞定图片中文问?需要做如下修改,大概?40多行的位|?br /> <div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: rgb(0, 0, 0);">String newFilename </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">;<br /> FileItemFactory factory </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> DiskFileItemFactory();<br /> ServletFileUpload upload </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> ServletFileUpload(factory);<br /> </span></div> 在其后添加一?指定~码为UTF-8的格?如下<br /> <div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: rgb(0, 0, 0);">String newFilename </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">;<br /> FileItemFactory factory </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> DiskFileItemFactory();<br /> ServletFileUpload upload </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> ServletFileUpload(factory);<br /> upload.setHeaderEncoding(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">UTF-8</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br /> </span></div> 代码是改掉了,可怎么部v到应用里面呢,前面有说?直接java源文件放在工E里~译启动里会报错,不知道是我哪里没弄好q是怎么回事,反正也没L腾了,改用土办?br /> 解压fckeditor-java-core-2.4.1.jar里面的class攑֜WEB-INF/classes?然后手工新生成的ConnectorServlet.class文g替换?WEB-INF/classes/net/fckeditor/connector/ConnectorServlet.class ,再启动服务器,如果没有报错的话,中文囄的上传问题就能搞定了<br /> <br /> 今天Z解决q个问题查了一天的资料,也顺便看了很多文?好像是FCKeditor2.4之后可以配置上传文g自动重命名的地方,我只看到一文档上提到q一?在官方网站上也没有找到相关的说明,也就不去找什么配|了,反正源代码已l改动过?不如把重命名也一h?扑ֈnet.fckeditor.connector.ConnectorServlet.java大概250行左?br /> <div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);"> We upload only one file at the same time</span><span style="color: rgb(0, 128, 0);"><br /> </span><span style="color: rgb(0, 0, 0);">FileItem uplFile </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> items.get(</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">);<br /> String rawName </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> UtilsFile.sanitizeFileName(uplFile.getName());<br /> String filename </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> FilenameUtils.getName(rawName);<br /> String baseName </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> FilenameUtils.removeExtension(filename);<br /> String extension </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> FilenameUtils.getExtension(filename);<br /> </span></div> 上面的代码改ؓ<br /> <div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);"> We upload only one file at the same time</span><span style="color: rgb(0, 128, 0);"><br /> </span><span style="color: rgb(0, 0, 0);">FileItem uplFile </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> items.get(</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">);<br /> String rawName </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> UtilsFile.sanitizeFileName(uplFile.getName());<br /> <br /> String randTimer </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> String.valueOf(Calendar.getInstance().getTimeInMillis());<br /> String randVal </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> String.valueOf(Math.abs((</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Random()).nextInt()));<br />                     <br /> String filename </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> FilenameUtils.getName(rawName);<br /> String baseName </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> randTimer </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> randVal;<br /> String extension </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> FilenameUtils.getExtension(filename);<br /> filename </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> baseName.concat(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">).concat(extension);</span></div> 卛_,此处我是用时间的毫秒串再加上一个随机数串构成的新文件名,当然也可以改成你自己喜欢的格?如将毫秒Ҏ日期旉字串,则只需修改<br /> <div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: rgb(0, 0, 0);">String randTimer </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> SimpleDateFormat(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">yyyyMMddHHmmss</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">)).format(</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Date());</span></div> 改好了之?重新生成class文g,按照上面的做法部|到应用中去<br /> <br /> Z方便使用,可以把修改后的class文g重新做成jar?WEB-INF/classes下的net和org目录拯C个新的空目录?然后在命令提C符下{到该目录,用如下命令可以生成新的jar?br /> <div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: rgb(0, 0, 0);">jar -cvf fckeditor-java-</span><span style="color: rgb(0, 0, 0);">2.4.1</span><span style="color: rgb(0, 0, 0);">-rename.jar *.*</span></div> 此处为生成一个fckeditor-java-2.4.1-rename.jar,当然,名字可以自己定义<br /> <br /> 上面的做法可能不是很先进,在Eclipse里也有打包jar的操?也许更新一个java源文件不会是q么ȝ,但ȝq样是搞定了,记录在这里先<br /> <img src ="http://www.aygfsteel.com/zhouf/aggbug/279808.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/zhouf/" target="_blank">ZhouFeng</a> 2009-06-03 14:41 <a href="http://www.aygfsteel.com/zhouf/articles/279808.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>在JSP中配|FCKeditor 2.6.4http://www.aygfsteel.com/zhouf/articles/279660.htmlZhouFengZhouFengTue, 02 Jun 2009 09:42:00 GMThttp://www.aygfsteel.com/zhouf/articles/279660.htmlhttp://www.aygfsteel.com/zhouf/comments/279660.htmlhttp://www.aygfsteel.com/zhouf/articles/279660.html#Feedback6http://www.aygfsteel.com/zhouf/comments/commentRss/279660.htmlhttp://www.aygfsteel.com/zhouf/services/trackbacks/279660.html FCKeditor q个开源的HTML 文本~辑器可以让web E序拥有如MS Word q样强大的编辑功能,.FCKeditor 支持当前行的浏览器?br />
2Q准备工作:

环境Qwinddows XP、tomcat6.0、JDK1.6
下蝲Q?br /> 1)QFCKeditor_2.6.4.zip
地址Qhttp://nchc.dl.sourceforge.net/sourceforge/fckeditor/FCKeditor_2.6.4.zip

2)Qfckeditor-java-2.4.1-bin.zip (JAVA支持?地址http://nchc.dl.sourceforge.net/sourceforge/fckeditor/fckeditor-java-2.4.1-bin.zip

3)Qslf4j-1.5.2.zip 地址 Qhttp://www.slf4j.org/dist/slf4j-1.5.2.zip

3.安装Q?br />
下面以jspZQ?br />
分别解压之后Q我们可以得C个fckeditor和fckeditor-java-2.4.1两个文g夏Vfckeditor文g夹下是需要调用的面和js文g{等Q有各种版本Q无所谓啦Q我们之需要jsp够了。将文g加全部复制到工程目录下等待调用即可?br /> 注意Q有炚w烦的是导包的问题。我们一共需?个包Qcommons-fileupload-1.2.1.jarQcommons-io-1.3.2.jarQfckeditor-java-core-2.4.1.jarQslf4j-api-1.5.6.jarQslf4j-simple-1.5.6.jar或slf4j-jdk14-1.5.6.jar?br /> 上面前四个包都可以在fckeditor-java-2.4.1文g夹下面找刎ͼ但是W五个却要另外去找,q点我非怸理解Qؓ什么不攑֜一赗?br /> 如果没有的话~译时就会出现如下错误信息:
严重: Servlet /fckeditorDemo threw load() exception
java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder



当然版本或许不同Q以上的版本是截?009-02-4的最新版本。如果想要最新版本,可以在slf4j的官|http://www.slf4j.org/download.html下到。但是要注意Q截止到2009-2-4Qslf4j官方最新版本是1.5.6Q但是fckeditor提供的slf4j-api却是1.5.2版本Q如果两个版本不一L话,你将会在控制台看到如下的消息Q?br />
严重: Servlet /Java threw load() exception
java.lang.IllegalAccessError: tried to access field org.slf4j.impl.StaticLoggerBinder.SINGLETON from class

org.slf4j.LoggerFactory



所以千万要注意版本一致问题。如果你实在觉得下蝲很麻烦,那就到这里下载吧Qhttp://www.slf4j.org/download.html


4.配置

1)在工E目录src/下新Z个文件fckeditor.propertiesQ添加内容:
connector.userFilesPath=UploadFile
connector.userActionImpl
=net.fckeditor.requestcycle.impl.UserActionImpl
其中W一行ؓ重新定义上传的文件夹,默认文g夹ؓuserfile,保存卛_?br /> 2)修改web.xmlQ用来提供上传功能支?br />
<servlet>                                          
      
<servlet-name>Connector</servlet-name>       
        
<servlet-class>                            
          net.fckeditor.connector.ConnectorServlet 
      
</servlet-class>                             
      
<load-on-startup>1</load-on-startup>         
</servlet>                                         
<servlet-mapping>                                  
      
<servlet-name>Connector</servlet-name>       
      
<url-pattern>                                
        /fckeditor/editor/filemanager/connectors/* 
      
</url-pattern>                               
</servlet-mapping>                            
5.应用,建立一JSP文g如下
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

String content=request.getParameter("edt1");
if (content != null) {
  content 
= content.replaceAll("\r\n""");
  content 
= content.replaceAll("\r""");
  content 
= content.replaceAll("\n""");
  content 
= content.replaceAll("\"", "'");
}else{
  content 
= "";
}

//下面是处理中文内容的~码转换
content 
= new String(content.getBytes("iso8859-1"),"utf-8");
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  
<head>
    
<base href="<%=basePath%>">
    
    
<title>FCKEditor 试</title>

  
</head>
  
<script type="text/javascript" src="fckeditor/fckeditor.js"></script>
  
<body>
    This is my JSP page. 
<br>
    
<form method="post" name="frm1">
    
<script type="text/javascript">
        
var oFCKeditor = new FCKeditor("edt1");
        oFCKeditor.BasePath 
= "fckeditor/";
        oFCKeditor.Height
='400';
        oFCKeditor.Value
="<%=content%>";
        oFCKeditor.Create();
    
</script>
    
<input type="submit" value="提交">
    
</form>
    
<hr>
    
<%=content%>
  
</body>
</html>
启动服务?用浏览器讉K卛_看到l果

今天折腾了一个下?l于是看到Ҏ果了,便记录在q里,上面的内容在|上转了一部分,因ؓ找不到原文出?也就没有注明?br />

ZhouFeng 2009-06-02 17:42 发表评论
]]>
վ֩ģ壺 | ½| Ϋ| | | | | | Ӣ| | | | | ɽ| ƽ½| ³ƶ| | | | | ߺ| ͤ| | ͩ| ˼| | °Ͷ| | ˲| ׿| Ϸ| ɽ| | | | ľ| ǧ| | ͷ| | |