「struts2」ServletRequestAware, ServletResponseAwareを実装するサンプルコード

Javaコード
public class UserAction extends ActionSupport implements SessionAware, ServletRequestAware, ServletResponseAware {
private HttpServletRequest request;
private HttpServletResponse response;

public void setServletRequest(HttpServletRequest request) {
this.request = request;
}

public void setServletResponse(HttpServletResponse response) {
this.response = response;
}

public String execute() {
HttpSession session = request.getSession();
return SUCCESS;
}
}

Java

Posted by arkgame