struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lukasz Lenart <>
Subject Re: Struts 1 -> Struts 2 migration session parameters not found
Date Thu, 27 Aug 2020 18:31:20 GMT
czw., 27 sie 2020 o 13:17 Natta Wang <> napisał(a):
> I start to migrate from Struts 1 to Struts 2 and found a problem that I want to ask for
help with the session.
> In Struts 1 web.xml, I have a Filter class that maps to servlet and when it be called,
it will set a parameter with an object.
> All Struts 1 JSP pages can access the session that has those parameters, and what I did
to the new Action class of Struts 2 is implements with SessionAware,
> in the class if found session object by ServletActionContext.getRequest().getSession(),
but cannot found the parameter with the parameter name that I expected it has.
> What I tried is added new filter-mapping in the web.xml file, which map url-pattern to
Struts 2 Action class (same with that mapped to servlet I mentioned above), hope it will be
called when opening with a specific URL but I failed as it comes out like the not set version.
> Can someone guide me on how to make the session and all parameters visible in the Action
class and JSP page?
> And one more thing, I use <s:include> the header page and header page also refers
to those session parameters. Do I need to implement any configuration to make header JSP can
access the session?

By using SessionAware, the session is going to be injected in your
action [1], in tags or JSPs you can use a named scope #session [2] to
access the attributes. But please be aware that Struts2 won't create
the session if it doesn't exist. You must use Session Create
Interceptor [3] to forcly create the session.


+ 48 606 323 122

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message