参考了wanghua305的文章解决了上传图片时出现的Security error. You probably don't have enough permissions to upload. Please check your server对话框(Struts2中使用时出现的这个问题,其他的就不知道了)
网址:http://wanghua305.iteye.com/blog/343093
原因:struts2对request进行了封装,所以当fck的request.getinputStream的时候就会出错.修改的方法就是对filtermapping的路径进行修改。
解决方法如下:
将下面代码中的“/*”
web.xml(原)
<filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
改为:“*.action”。
另外,jsp页面上面用到了struts2的tag,那么就要增加一个*.jsp的url-pattern。
修改后如下:
<filter-mapping> <filter-name>struts2</filter-name> <url-pattern>*.action</url-pattern> </filter-mapping> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>*.jsp</url-pattern> </filter-mapping>
如果你用到struts2的datetimepicker标签发现他不能用了
你查看源代码的时候会发现有如下代码:
<link rel="stylesheet" href="/para/struts/xhtml/styles.css" type="text/css"/>
<script language="JavaScript" type="text/javascript">
// Dojo configuration
djConfig = {
baseRelativePath: "/para/struts/dojo",
isDebug: false,
bindEncoding: "utf-8",
debugAtAllCosts: true // not needed, but allows the Venkman debugger to work with the includes
};
</script>
<script language="JavaScript" type="text/javascript"
src="/para/struts/dojo/dojo.js"></script>
<script language="JavaScript" type="text/javascript"
src="/para/struts/simple/dojoRequire.js"></script>
这时加上以下过滤后问题解决:
<filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/struts/*</url-pattern> </filter-mapping>
当然要用datetimepicker标签在<head>中还要加入 <s:head theme="ajax"/>
总结:
我在上传时遇到的Security error. You probably don't have enough permissions to upload. Please check your server.这个问题而不能上传,只要修改web.xml文件中的struts配置即可
原web.xml:
<filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
修改后:
<filter-mapping> <filter-name>struts2</filter-name> <url-pattern>*.action</url-pattern> </filter-mapping> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>*.jsp</url-pattern> </filter-mapping> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/struts/*</url-pattern> </filter-mapping>
——————————————————————The End————————————————————————