struts2

<action name="timeCommitment" class="forwardAction">

  <result>timeCommitment.jsp</result>

</action>

<action name="findTimeCommitmentByParam" class="timeCommitmentAction"

method="findTimeCommitmentByParam">

<result type="json">

<param name="includeProperties">

timeCommitments.*,totalSize,msg

</param>

</result>

</action>

<!-- 导出 -->

<action name="exportTimeCommitmentData"

class="timeCommitmentAction" method="exportTimeCommitmentData">

<result type="stream" name="success">

<param name="contentType">${downloadMimeType}</param>

<param name="inputName">stream</param>

<param name="contentDisposition">

attachment;filename="${downloadFileName}"

</param>

<param name="bufferSize">4096</param>

</result>

</action>

<action name="findTownNameBySrcAndDest" 

class="timeCommitmentAction" method="findTownNameBySrcAndDest">

<result type="json">

<param name="includeProperties">

regionList.*,totalSize,msg

</param>

</result> 

</action>

 

@Resource 

private ITimeCommitmentBiz timeCommitmentBiz;

 

//错误信息

private String msg;

 

//标识方法是否执行成功

private boolean success = true;

 

//页面展示集合

private Collection<TimeCommitment> timeCommitments;

 

//查询总数

private long totalSize;

 

//上传对象文件

private File uploadFile;

 

//上传文件的处理结果信息

private List<BatchDealResult> batchDealResult;

 

// 下载对象

private DownloadResult downLoadResult;

 

private List<KeyValueBean> regionList; 

 

private TimeCommitment commitment;

 

/**

* 查询时效承诺明细信息

* @author sfit0104

* Jan 8, 2016

* @return

*/

public String findTimeCommitmentByParam(){

try{

ActionContext context = ActionContext.getContext();

QueryParam queryParam = new QueryParam(context.getParameters());

Page<TimeCommitment> page=timeCommitmentBiz.findTimeCommitmentByParam(queryParam);

this.timeCommitments=page.getData();

totalSize=page.getTotalSize();

success=true;

}catch(Exception ce){

success=false;

msg=ce.getMessage();

log.error("query findTimeCommitmentByParam error!",ce);

}

return SUCCESS;

}

 

/**

* 导出时效承诺明细信息

* @author sfit0104

* Jan 8, 2016

* @return

*/

public String exportTimeCommitmentData(){

try{

ActionContext context = ActionContext.getContext();

QueryParam params = new QueryParam(context.getParameters());;

downLoadResult=timeCommitmentBiz.exportTimeCommitmentData(params);

success = true;

}catch(Exception ce){

success = false;

msg = ce.getMessage();

log.error("exportDateflowCfgData error",ce);

}

return SUCCESS;

}

你可能感兴趣的:(json,struts2)