我正在尝试在 Struts 2 中使用
Session
:
private Map<String, Object> session = ActionContext.getContext().getSession();
但我收到此错误:
Exception in thread "main" java.lang.NullPointerException: Cannot invoke
"com.opensymphony.xwork2.ActionContext.getSession()" because the return value of
"com.opensymphony.xwork2.ActionContext.getContext()" is null
我尝试使用 Struts 的
SessionMap
但仍然收到相同的错误消息。我尝试过更改 struts-core
库,也尝试了 Google 的一些解决方案,但仍然没有解决这个问题。