「Struts2開発」アノテーション@Resultsと@Resultの使い方

Javaコード:
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;

import com.opensymphony.xwork2.ActionSupport;

@Results( { @Result(name = “global", location = “/global.jsp") })
public class AnnotDemo extends ActionSupport {

@Action(value = “/startnews24/url", results = { @Result(name = SUCCESS, location = “/startnews24/success.jsp"),
@Result(name = “failure", location = “/startnews24/fail.jsp") })
public String execute() {
if (System.currentTimeMillis() % 3 == 0) {
return “failure";
} else if (System.currentTimeMillis() % 3 == 1) {
return SUCCESS;
} else {
return “global";
}
}

@Action(“globalTest")
public String global() {
return “global";
}

@Action(value = “globalOverWrite", results = { @Result(name = “global", location = “/startnews24/globalOverWrite.jsp") })
public String globalOverWrite() {
return “global";
}

}

Java

Posted by arkgame