struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From M Huzaifah <mhuzaifah.i...@gmail.com>
Subject Re: Struts 1 -> Struts 2 migration session parameters not found
Date Thu, 27 Aug 2020 11:48:13 GMT
Hii Natta Wang,

Are you try using session interceptor? In java, the session could access
using ServletActionContext.getRequest().getSession(); it will return
servlet HttpSession and use getAttribute() method to ge your particular
session by given sessionAttribut name.

To access session in jsp, i usualy using
${sessionScope.yourSesionAttributName}

Regards...

On Thu, Aug 27, 2020, 6:17 PM Natta Wang <xenogew@gmail.com> wrote:

> 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?
>
> Any help or suggestion are appreciated.
> Thanks.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message