Hi, Yeah Wes, you are correct, i was so stuck with this and couldnt see that i can straightly put that to the session from the Action class...
Thank you so much for reminding me this.... -- Regards Kushan Jayathilake On Fri, Jun 18, 2010 at 11:03 AM, Wes Wannemacher <w...@wantii.com> wrote: > What you want is this - > > <s:set name="sessionValue" value="%{accountList}" scope="session" /> > > However, what i'm wondering right now is this - > > you have to expose "accountList" most likely by having a getter/setter > combination on the action that is rendering the JSP that contains this > tag. Assuming you are placing the variable in the session so that you > can retrieve it from another action, why have the object pushed into > the session from a view? I mean, if you have it in an action, why not > push it into the session in that action? > > To me, setting session variables from a view smells a bit like > business logic creeping into your view layer. I probably don't know > enough about the task to say for sure, and the tag above should get > the job done, but consider what I'm saying... One of the advantages of > adopting an MVC framework is to abstract business logic away from the > views in your application. If the view performs more than just > displaying the appropriate data, it is potentially less reusable by > different actions (although it doesn't happen a lot that a view is > reused by different actions, it does happen more often if you're > properly disciplined in separating the business logic). > > -Wes > > On Fri, Jun 18, 2010 at 1:24 AM, Kushan Jayathilake <kusha...@gmail.com> > wrote: > > Hi, > > > > Thanks for replying... > > > > > > In my JSP i put the <s:set> as you said, i want to get the value from the > > Action class and set that value in the session in the JSP, so i wrote, > > > > <s:set name="sessionValue" value="<s:property value="accountList"/>" > > scope="session"/> > > > > note that "accountList" is a java.util.List in the Action class, i want > to > > get that list to the JSP and assign its value to the session, > > > > but it gives "equal symbol expected" error... > > > > Can you please suggest me a way to do this..? > > > > -- > > Regards > > Kushan Jayathilake > > > > > > On Fri, Jun 18, 2010 at 10:41 AM, Wes Wannemacher <w...@wantii.com> > wrote: > > > >> http://struts.apache.org/2.x/docs/set.html > >> > >> Notice particularly the "scope" attribute. > >> > >> -Wes > >> > >> On Fri, Jun 18, 2010 at 1:01 AM, Kushan Jayathilake <kusha...@gmail.com > > > >> wrote: > >> > Hi Guys, > >> > > >> > Can anyone suggest me a way to set a variable in the session in the > JSP > >> and > >> > access that variable in the action class.. (variable must be set from > the > >> > JSP file to the session) > >> > > >> > iam using struts 2.. is there anyway to do this..? > >> > > >> > -- > >> > Regards > >> > Kushan Jayathilake > >> > > >> > >> > >> > >> -- > >> Wes Wannemacher > >> > >> Head Engineer, WanTii, Inc. > >> Need Training? Struts, Spring, Maven, Tomcat... > >> Ask me for a quote! > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > >> For additional commands, e-mail: user-h...@struts.apache.org > >> > >> > > > > > > -- > Wes Wannemacher > > Head Engineer, WanTii, Inc. > Need Training? Struts, Spring, Maven, Tomcat... > Ask me for a quote! > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > >