Refer:
Http://struts.apache.org/2.0.11/docs/result-annotation.html
Http://jdkcn.com/entry/add-params-to-struts2-result-annotation.html
In the original webwork xml configuration file, you can add some additional parameters to the <result> node under <action>.
<Result...>
<Param name = "">... </param>
</Result>
What should I do after changing to @ result annotation.
View @ resultSource codeA Params string array is found.
@ Retention (retentionpolicy. runtime)
Public @ interface result {
String name () default action. success;
Class type () default nullresult. Class;
String Value ();
String [] Params () default {};
}
However, the original Param configuration is a key-value pair of key and value. Later I found the struts2 document, which originally stipulated the key and value in the string array.
- 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 "})
What about passing parameters?
@ Result (name = "success ",
Type = "redirectaction ",
Location = "D-list ",
Params = {"ID", "% {ID }""}
)
In this way, when return success is returned, it will jump to D-list? Id = xxxx