package com.InteriorDesign.action;
import javax.servlet.ServletConfig;
import javax.servlet.jsp.PageContext;
import org.apache.log4j.Logger;
import org.apache.struts2.ServletActionContext;
import org.springframework.stereotype.Component;
import com.opensymphony.xwork2.ActionSupport;
@SuppressWarnings("serial")
@Component("forwardAction")
public class ForwardAction extends ActionSupport {
private Logger logger=Logger.getLogger(ForwardAction.class);
public String execute(){
logger.info("============");
logger.info(ServletActionContext.getResponse()==null);
logger.info(ServletActionContext.getPageContext()==null);
logger.info(ServletActionContext.getPageContext().getServletConfig()==null);
return "success";
}
}
请问如何才能正常获取PageContext对象而不为空呢?
ServletActionContext.getResponse() 这个是有值非空的
而只是ServletActionContext.getPageContext()==null