日期:2014-05-16  浏览次数:20373 次

struts2和json-lib组合配置
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
	<include file="struts-default.xml" />
	<package name="simple" extends="struts-default">
		<action name="download" class="fileAction" method="download">
			<result name="success" type="stream">
				<param name="contentType">application/octet-stream;charset=ISO8859-1</param>
				<param name="inputName">inputStream</param>
				<param name="contentDisposition">attachment;filename="${downloadFileName}"</param>
				<param name="bufferSize">4096</param>
			</result>
		</action>
	</package>
	<package name="json" extends="json-default">
		<action name="getDirectories" class="fileAction" method="getDirectories">
			<result type="json">
				<param name="root">nodes</param>
				<param name="excludeNullProperties">true</param>
			</result>
		</action>
		<action name="getFiles" class="fileAction" method="getFiles">
			<result type="json">
				<param name="root">page</param>
				<param name="excludeNullProperties">true</param>
				<param name="excludeProperties">conditions,limit,start,success,objCondition</param>
			</result>
		</action>
		<action name="uploadFiles" class="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>
		<action name="createFolder" class="fileAction" method="createFolder">
			<result type="json">
				<param name="includeProperties">success</param>
			</result>
		</action>
		<action name="deleteFiles" class="fileAction" method="deleteFiles">
			<result type="json">
				<param name="includeProperties">success</param>
			</result>
		</action>
		<action name="compressionFiles" class="fileAction" method="compressionFiles">
			<result type="json">
				<param name="includeProperties">success</param>
			</result>
		</action>
		<action name="decompressionFiles" class="fileAction" method="decompressionFiles">
			<result type="json">
				<param name="includeProperties">success</param>
			</result>
		</action>
	</package>
</struts>
?