J2EE学习笔记——JSP使用Fckeditor 上传图片

首先需要下载     FCKidetor  所用的文件  和相关 jar 包     并导入,    在这里下载             点击下载FCK文件和jar包 


项目截图:


一、FCK配置

1、解压FCKidetor  所用的jar 包  (上面下载的)后,将jar包导入至工程的lib中;

2、FCKeditor.zip解压后,将fckeditor文件夹整个拷贝至WebRoot下。

3、新建fckditor.propertise(---文件放到src目录下)   

      fckditor.propertise  的内容为:connector.userActionImpl=net.fckeditor.requestcycle.impl.UserActionImpl


4、在web.xml中加入下面一段代码:

<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>

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

index.jsp代码:

 
<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'index.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">
	
	
	<script language="javascript" type="text/javascript" src="DatePicker/WdatePicker.js" ></script>
 <script type="text/javascript" src="fckeditor/fckeditor.js"></script>
 
	<script type="text/javascript">

window.onload = function()
{
	
    var sBasePath="<%=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/fckeditor/" %>"
	var oFCKeditor = new FCKeditor( 'pfckeditor' ) ;
	oFCKeditor.BasePath	= sBasePath ;
	oFCKeditor.ReplaceTextarea() ;
}

	</script>
  </head>
  
  <body>
   <form action ="SaveTheFCK" method="post">
 

    <textarea rows="90" cols="120" name="pfckeditor">
    </textarea>
    <br>
    点击显示日期: <input type="text" name="time" onClick="WdatePicker()">
    <br>
    <input type="submit" value="提交">
    </form>
  </body>
</html>




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

程序源代码:点击下载 源代码

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值