Apr 02
在原来的webwork式的xml配置文件里可以给<action>下的<result>节点添加一些额外的参数。
<result ..> 那换成@Result annotation之后要怎么做呢。
<param name="">...</param>
</result>
看@Result的源代码发现有个params的String数组
@Retention(RetentionPolicy.RUNTIME)
public @interface Result {
String name() default Action.SUCCESS;
Class type() default NullResult.class;
String value();
String[] params() default {};
}
可是原来的param配置是个key和value的键值对啊。后来查到struts2的文档原来就这个String数组里约定的是key,value,这样的顺序。
- params - An Array of the parameters in the form {key1, value1, key2, value2}
@Result(name="error",type=FreemarkerResult.class, value="/error.ftl", params={"contentType", "application/xml"}) 参数这里:http://struts.apache.org/2.0.11/docs/result-annotation.html
Like others
Trackback:add-params-to-struts2-result-annotation

Saturday, June 07, 2008, 03:02:40 AM (CST)
xzfenrcc http://fmgoatuf.com okhgzhkt jatzucut [URL=http://gbgnraal.com]oghthobh[/URL] <a href="http://cklhgbvc.com">hsdtreng</a>