記憶庫

自分用のメモです。

Action クラス内からサーブレットコンテキストを取得する方法

Struts の Action クラスからサーブレットコンテキストを取得する方法は以下の通り。

public class XXXAction extends Action {
  
  @Override
  public ActionForward execute(
    ActionMapping aMapping,
    ActionForm aForm,
    HttpServletRequest aRequest,
    HttpServletResponse aResponse
  ) {
		
    …
    
    ServletContext _ctx = super.getServlet().getServletContext();
		
    …
  }
}