「Struts2入門」ServletContextを取得するサンプル

サンプルコード

import javax.servlet.ServletContext;
import org.apache.struts2.ServletActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class CustomerAction extends ActionSupport{

    public String execute() throws Exception {

        ServletContext context = ServletActionContext.getServletContext();

        return SUCCESS;

    }

}

 

Java

Posted by arkgame