FCKeditor in JSP file upload failure resolution method

Source: Internet
Author: User
Tags file upload

FCKeditor in JSP Tutorial file upload failed Solution

My code is as follows

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>/js/fckeditor/editor/filemanager/connectors/*</url-pattern>
</servlet-mapping>

fck.jsp

<% @taglib uri= "http://java.fckeditor.net" prefix= "FCK"%>
<script type= "text/web Effects" >
function Fckeditor_oncomplete (editorinstance) {
Window.status = editorinstance.description;
}
</script>

<fck:editor instancename= "Platform_partner" height= "250px" width= "700px" >
<jsp:attribute name= "value" ><s:property value= "Partner.info.platform_partner" escape= "false"/> </ Jsp:attribute>
</fck:editor>

Solving method

Xml

<filter>
<filter-name>struts2</filter-name>
<!--<filter-class>org.apache.struts2.dispatcher.ng.filter.strutsprepareandexecutefilter</ Filter-class>-->
<filter-class>com.platform.my.struts2.helper.customfilters.myfckhelperfilterdispatcher</filter-class >
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<!--FCKeditor-->

<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>/js/fckeditor/editor/filemanager/connectors/*</url-pattern>
</servlet-mapping>


Myfckhelperfilterdispatcher.java (My custom filter)
Package com.platform.my.struts2.helper.customfilters;
Import Org.apache.struts2.dispatcher.ng.filter.strutsprepareandexecutefilter;
Import javax.servlet.*;
Import javax.servlet.http.*;
Import java.io.*;

public class Myfckhelperfilterdispatcher extends Strutsprepareandexecutefilter {
public void Dofilter (ServletRequest req, servletresponse Res, Filterchain chain) throws IOException, Servletexception {
String url = ((https tutorial ervletrequest) req). Getrequesturi ();
if (Url.indexof ("FCKeditor") < 0) {
Super.dofilter (req, res, chain);
}
else{
Chain.dofilter (req, res);
}
}
}

Fckeditor.properties
Connector.useractionimpl=net.fckeditor.requestcycle.impl.useractionimpl
Fckeditor.basepath=/js/fckeditor
connector.userfilespath=/partner/uploads/

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.