1 . 获取方法如下:
package 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"; } }
时间: 2024-12-15 01:45:11