struts2 配置文件 <package name="json" extends="json-default">
<action name="uploadFiles" class="com.dmp.cms.actions.FileAction" method="uploadFiles">
<result name="success" type="json">
<param name="includeProperties">success</param>
</result>
<result name="input" type="json">
<param name="includeProperties">success</param>
</result>
</action>
</package> action的代码
public String uploadFiles() {
System.out.println(getMyUpload()+"_____________+______________________");
String rootPath = this.getRequest().getSession().getServletContext().getRealPath("/");
System.out.println("rootPath="+rootPath);
rootPath += ROOT;
String sp = rootPath + getPath();
System.out.println("sp="+sp);
FileUtils.mkDirectory(sp);
System.out.println("sp="+sp);
try {
FileUtils.upload(getMyUploadFileName(), sp, getMyUpload());
this.success = true;
} catch (RuntimeException e) {
e.printStackTrace();
}
System.out.println(success);
return SUCCESS;
}为什么会报下面这个错误 WARN - Caught OgnlException while setting property 'includeProperties' on type 'com.googlecode.jsonplugin.JSONResult'. ognl.NoSuchPropertyException: com.googlecode.jsonplugin.JSONResult.includeProperties
at ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:132)
at com.opensymphony.xwork2.util.OgnlValueStack$ObjectAccessor.setProperty(OgnlValueStack.java:68)
at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1656)
at ognl.ASTProperty.setValueBody(ASTProperty.java:101)
at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
at ognl.SimpleNode.setValue(SimpleNode.java:246)
<action name="uploadFiles" class="com.dmp.cms.actions.FileAction" method="uploadFiles">
<result name="success" type="json">
<param name="includeProperties">success</param>
</result>
<result name="input" type="json">
<param name="includeProperties">success</param>
</result>
</action>
</package> action的代码
public String uploadFiles() {
System.out.println(getMyUpload()+"_____________+______________________");
String rootPath = this.getRequest().getSession().getServletContext().getRealPath("/");
System.out.println("rootPath="+rootPath);
rootPath += ROOT;
String sp = rootPath + getPath();
System.out.println("sp="+sp);
FileUtils.mkDirectory(sp);
System.out.println("sp="+sp);
try {
FileUtils.upload(getMyUploadFileName(), sp, getMyUpload());
this.success = true;
} catch (RuntimeException e) {
e.printStackTrace();
}
System.out.println(success);
return SUCCESS;
}为什么会报下面这个错误 WARN - Caught OgnlException while setting property 'includeProperties' on type 'com.googlecode.jsonplugin.JSONResult'. ognl.NoSuchPropertyException: com.googlecode.jsonplugin.JSONResult.includeProperties
at ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:132)
at com.opensymphony.xwork2.util.OgnlValueStack$ObjectAccessor.setProperty(OgnlValueStack.java:68)
at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1656)
at ognl.ASTProperty.setValueBody(ASTProperty.java:101)
at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
at ognl.SimpleNode.setValue(SimpleNode.java:246)
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货