ytrstu / vosao

Automatically exported from code.google.com/p/vosao
GNU Lesser General Public License v2.1
0 stars 0 forks source link

session variable #309

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
hello,

can I use session variable in vosao cms?

thanks

Original issue reported on code.google.com by angelome...@gmail.com on 11 Aug 2010 at 2:52

GoogleCodeExporter commented 8 years ago
Yes you can. 

You can access request object in any place of Vosao Java code if it's called 
after ContextFilter by using VosaoContext.getInstance).getRequest() call.

To change session value you need to call session setAttribute every time even 
if object is already in session.

Original comment by kinyelo@gmail.com on 11 Aug 2010 at 10:09

GoogleCodeExporter commented 8 years ago
what is the command? is it using velocity or java?

Original comment by angelome...@gmail.com on 13 Aug 2010 at 5:02

GoogleCodeExporter commented 8 years ago
For Java:

VosaoContext.getInstance).getRequest().getSession().setAttribute("session_var", 
"value
");

For Velocity:

$request.getSession().setAttribute("session_var", "value")

Original comment by kinyelo@gmail.com on 13 Aug 2010 at 5:56

GoogleCodeExporter commented 8 years ago
is it also means that I can set session var in my servlet and call it in vosao 
using that function!?

thanks

Original comment by angelome...@gmail.com on 13 Aug 2010 at 6:11

GoogleCodeExporter commented 8 years ago
Yes.

Original comment by kinyelo@gmail.com on 13 Aug 2010 at 6:21

GoogleCodeExporter commented 8 years ago
that's great! thanks

Original comment by angelome...@gmail.com on 13 Aug 2010 at 6:56

GoogleCodeExporter commented 8 years ago

Original comment by kinyelo@gmail.com on 13 Aug 2010 at 7:37

GoogleCodeExporter commented 8 years ago
where should I put this code 
"VosaoContext.getInstance().getRequest().getSession().getAttribute("sCity");"! 
can I put it in the page?

Original comment by angelome...@gmail.com on 13 Aug 2010 at 8:16

GoogleCodeExporter commented 8 years ago
You can put this on JSP page.

Original comment by kinyelo@gmail.com on 13 Aug 2010 at 8:46

GoogleCodeExporter commented 8 years ago
and how can I get the session in vosao page?

Original comment by angelome...@gmail.com on 13 Aug 2010 at 8:48

GoogleCodeExporter commented 8 years ago
do I need any jar file plugin?

Original comment by angelome...@gmail.com on 13 Aug 2010 at 8:48