さくっとくんでみた。
設定ファイル等
IndexAction
package action;
import java.util.Map;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import org.apache.struts2.interceptor.SessionAware;
import com.opensymphony.xwork2.ActionSupport;
@Namespace("/")
@ParentPackage("tiles-default")
@Action("index")
@Results({
@Result(name = "success", location = "index_jsp", type = "tiles"),
@Result(name = "input", location = "index_jsp", type = "tiles"),
@Result(name = "error", location = "index_jsp", type = "tiles")
})
public class IndexAction extends ActionSupport implements SessionAware, SessionKey {
protected Map<String, Object> session;
@Override
public String execute() throws Exception {
return SUCCESS;
}
public void setSession(Map<String, Object> session) {
this.session = session;
}
}
index.jsp
<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles"%>
<%@ taglib prefix="tilesx" uri="http://tiles.apache.org/tags-tiles-extras"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<html>
<head>
<s:head />
<title>
<tiles:insertAttribute name="TITLE" />
</title>
</head>
<body>
<h2>
<tiles:insertAttribute name="TITLE"/>
</h2>
</body>
</html>