1. Questions about uploading pictures failed
First Import Jar Pack
Commons-fileupload-1.2.2.jar,ueditor.jar
Then modify the Editor_config.js
Locate and modify the URL modification to window. ueditor_home_url| | " /mypro/ueditor/"Where Mypro is the name of my project
ImagePath modified to URL + "upload/"
Let's say our picture store path is ueditor/upload/
Then modify the imageup.jsp
Up.setsavepath ("") is modified to Up.setsavepath ("". /imageup ");
This sets the storage path for the picture to Ueditor/upload/imageup
Then if you do not configure the Struts2 interceptor in Web.xml, you should be able to upload it successfully, and then if you need to combine the STRUTS2 interceptor, you need to add a different configuration
The idea is to create an interceptor yourself, replace the default interceptor, and then filter the path that you don't want to intercept, and the rest with the default interceptor.
First create an Interceptor class
Copy Code code as follows:
public class Mystrutsfilter extends Strutsprepareandexecutefilter {
public void Dofilter (ServletRequest req, servletresponse Res,
Filterchain chain) {
HttpServletRequest request = (httpservletrequest) req;
String URL = Request.getrequesturi ();
if (Url.contains ("ueditor/jsp/")) {<span style= "White-space:pre" > </span>//this is to filter all files under the entire folder.
try {
Chain.dofilter (req, res);
catch (IOException e) {
E.printstacktrace ();
catch (Servletexception e) {
E.printstacktrace ();
}
} else {
try {
Super.dofilter (req, res, chain)//The Interceptor with the default parent class, that is, struts2
catch (IOException e) {
E.printstacktrace ();
catch (Servletexception e) {
E.printstacktrace ();
}
}
}
}
And then define it in Web.xml.
Copy Code code as follows:
<?xml version= "1.0" encoding= "UTF-8"?>
<web-app version= "3.0"
Xmlns= "Http://java.sun.com/xml/ns/javaee"
Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"
Xsi:schemalocation= "Http://java.sun.com/xml/ns/javaee
Http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd ">
<display-name></display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<filter>
<filter-name>struts2</filter-name>
<filter-class>
Cn.xyx.web.filter.MyStrutsFilter
<!--use custom interceptors here,. JSP does not do processing, others use the default interceptor-
Note that this replaces the default Struts2 interceptor Org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter-->
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<error-page>
<error-code>404</error-code>
<location>/404.jsp</location>
</error-page>
</web-app>
So the configuration is OK