开始建了一个tomcat 启动的工程,
代码不报错。后来我建立了一个dynamic web project 同样的代码。
在*。java中的下面的代码报错
public class DivLoginAction extends ActionSupport{不想关的代码略掉了。
......................
......................
ServletActionContext.getRequest().getSession(true).setAttribute("username", username);
ServletActionContext.getRequest().setAttribute("status","success");
................
......................
}
在jsp文件中的代码
new File(getServletContext().getRealPath("")也报错
ServletActionContext 和getServletContext这个要是用需要什么条件吗?
需要怎样修改才可以?
代码不报错。后来我建立了一个dynamic web project 同样的代码。
在*。java中的下面的代码报错
public class DivLoginAction extends ActionSupport{不想关的代码略掉了。
......................
......................
ServletActionContext.getRequest().getSession(true).setAttribute("username", username);
ServletActionContext.getRequest().setAttribute("status","success");
................
......................
}
在jsp文件中的代码
new File(getServletContext().getRealPath("")也报错
ServletActionContext 和getServletContext这个要是用需要什么条件吗?
需要怎样修改才可以?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货