Action类中通过ServletActionContext来获取web资源
2021-06-16 20:03
标签:logs let return package span pac 获取 div success 1 . 获取方法如下: Action类中通过ServletActionContext来获取web资源 标签:logs let return package span pac 获取 div success 原文地址:http://www.cnblogs.com/beibidewomen/p/7270205.htmlpackage com.xuzhiwen.test;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.apache.struts2.ServletActionContext;
public class ServletAction {
public String getServletAction(){
//request
HttpServletRequest request = ServletActionContext.getRequest();
//session
HttpSession session = request.getSession();
//servletContext
ServletContext servletContext = ServletActionContext.getServletContext();
return "success";
}
}
文章标题:Action类中通过ServletActionContext来获取web资源
文章链接:http://soscw.com/index.php/essay/94712.html