You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Srineel Mazumdar <sm...@gmail.com> on 2013/09/03 08:05:36 UTC

Migrating Struts 1 application to Struts 2

Hi All,

I am migrating an application from Struts 1 to Struts 2 and frequently I am
facing scenarios where I need to use request.getSession to set/get
attributes. As far as my knowledge goes, this is not considered to be a
best practice in Struts 2. What is the best was way to handle this scenario
?

Regards,
Srineel

Re: Migrating Struts 1 application to Struts 2

Posted by NIJO GEORGE <ni...@gmail.com>.
yes... you can set session as Key  Value pairs and retrieved easily in
Struts2. Struts2 OGNL expressions can be used in getting session value from
the value stack. My Sturts2 knowledge is average. so you can refer some
tutorials for more clarification


On Tue, Sep 3, 2013 at 11:51 AM, Srineel Mazumdar <sm...@gmail.com>wrote:

> Thanks a lot !!
>
> I can get the values in userSession which will be like
> session.getAttribute.. but what about session.getAttribute?? Can I set a
> key value pair in userSession and it will automatically picked up ?
>
>
> On Tue, Sep 3, 2013 at 2:12 AM, NIJO GEORGE <ni...@gmail.com> wrote:
>
> > Using the sessionAware interceptor may fix your scenario
> >
> >
> >
> http://struts.apache.org/release/2.0.x/struts2-core/apidocs/org/apache/struts2/interceptor/SessionAware.html
> >
> >
> >
> http://www.itinpractice.com/tutorials/403/implementing-sessionaware-interface.html#.UiV9KNI6BQ4
> >
> > http://struts.apache.org/development/2.x/docs/http-session.html
> >
> >
> > On Tue, Sep 3, 2013 at 11:35 AM, Srineel Mazumdar <smaz19584@gmail.com
> > >wrote:
> >
> > > Hi All,
> > >
> > > I am migrating an application from Struts 1 to Struts 2 and frequently
> I
> > am
> > > facing scenarios where I need to use request.getSession to set/get
> > > attributes. As far as my knowledge goes, this is not considered to be a
> > > best practice in Struts 2. What is the best was way to handle this
> > scenario
> > > ?
> > >
> > > Regards,
> > > Srineel
> > >
> >
> >
> >
> > --
> > NIJO GEORGE P
> > Follow me on Twitter <http://www.twitter.com/nijogeorgep>
> > Add me as Friend <http://www.facebook.com/nijogeorgep>
> > View my Profile on LinkedIn <http://in.linkedin.com/in/nijogeorgep>
> > +918089699703
> >
>



-- 
NIJO GEORGE P
Follow me on Twitter <http://www.twitter.com/nijogeorgep>
Add me as Friend <http://www.facebook.com/nijogeorgep>
View my Profile on LinkedIn <http://in.linkedin.com/in/nijogeorgep>
+918089699703

Re: Migrating Struts 1 application to Struts 2

Posted by Srineel Mazumdar <sm...@gmail.com>.
Thanks a lot !!

I can get the values in userSession which will be like
session.getAttribute.. but what about session.getAttribute?? Can I set a
key value pair in userSession and it will automatically picked up ?


On Tue, Sep 3, 2013 at 2:12 AM, NIJO GEORGE <ni...@gmail.com> wrote:

> Using the sessionAware interceptor may fix your scenario
>
>
> http://struts.apache.org/release/2.0.x/struts2-core/apidocs/org/apache/struts2/interceptor/SessionAware.html
>
>
> http://www.itinpractice.com/tutorials/403/implementing-sessionaware-interface.html#.UiV9KNI6BQ4
>
> http://struts.apache.org/development/2.x/docs/http-session.html
>
>
> On Tue, Sep 3, 2013 at 11:35 AM, Srineel Mazumdar <smaz19584@gmail.com
> >wrote:
>
> > Hi All,
> >
> > I am migrating an application from Struts 1 to Struts 2 and frequently I
> am
> > facing scenarios where I need to use request.getSession to set/get
> > attributes. As far as my knowledge goes, this is not considered to be a
> > best practice in Struts 2. What is the best was way to handle this
> scenario
> > ?
> >
> > Regards,
> > Srineel
> >
>
>
>
> --
> NIJO GEORGE P
> Follow me on Twitter <http://www.twitter.com/nijogeorgep>
> Add me as Friend <http://www.facebook.com/nijogeorgep>
> View my Profile on LinkedIn <http://in.linkedin.com/in/nijogeorgep>
> +918089699703
>

Re: Migrating Struts 1 application to Struts 2

Posted by NIJO GEORGE <ni...@gmail.com>.
Using the sessionAware interceptor may fix your scenario

http://struts.apache.org/release/2.0.x/struts2-core/apidocs/org/apache/struts2/interceptor/SessionAware.html

http://www.itinpractice.com/tutorials/403/implementing-sessionaware-interface.html#.UiV9KNI6BQ4

http://struts.apache.org/development/2.x/docs/http-session.html


On Tue, Sep 3, 2013 at 11:35 AM, Srineel Mazumdar <sm...@gmail.com>wrote:

> Hi All,
>
> I am migrating an application from Struts 1 to Struts 2 and frequently I am
> facing scenarios where I need to use request.getSession to set/get
> attributes. As far as my knowledge goes, this is not considered to be a
> best practice in Struts 2. What is the best was way to handle this scenario
> ?
>
> Regards,
> Srineel
>



-- 
NIJO GEORGE P
Follow me on Twitter <http://www.twitter.com/nijogeorgep>
Add me as Friend <http://www.facebook.com/nijogeorgep>
View my Profile on LinkedIn <http://in.linkedin.com/in/nijogeorgep>
+918089699703