当前位置: 代码迷 >> Web前端 >> action返回类型引文格式
  详细解决方案

action返回类型引文格式

热度:122   发布时间:2012-08-21 13:00:22.0
action返回类型注解格式
@Results({
@Result(name="ajaxData",params= {"root","jsdata"},type="json"),
@Result(name="result",params= {"root","result"},type="json"),
@Result(name="indexView",location="/metadata/indexView.jsp",type="dispatcher"),
@Result(name="jsonData",params= {"root","jsdata_index"},type="json"),
@Result(name="excel",params= {"contentType","application/vnd.ms-excel","inputName","excelStream","bufferSize","1024","contentDisposition","filename=export.xls"},type="stream")

})

@Result相当于struts.xml文件中的<result>元素的内容。使用@Result必须指定一个name属性,相当于<result name=””/>另外,它还有几个可选的属性。

☆ type 相当于<result type=””/>指定返回视图资源的类型

☆ location 相当于<result>…..</result>中间部分,用于指定实际视图位置

☆ params:该属性相当于<result/>元素里多个<param../>子元素的作用,用于为该Result指定参数值。该属性应满足{“name1”,”value1”,”name2”,”value2”}格式

  相关解决方案