Help with session in monorail

42 views
Skip to first unread message

Cesar Lopez

unread,
Apr 12, 2012, 12:59:49 AM4/12/12
to castle-pro...@googlegroups.com
Hello,

I have this conde inside an action in a controller.

e.g

Controller {
public void Index() {
Context.Session["sessionuser"] = user;
}
}

Now, I want to read the value of Context.Session["sessionuser"]  from my .vm file (velocity file)
But I do not know how to do that..

I do


$sessionuser.name but no value is returned..

Please help!

Ricardo Borges

unread,
Apr 12, 2012, 8:21:06 AM4/12/12
to castle-pro...@googlegroups.com
Luckly, you can't do that. You must pass the value to the view using PropertyBag:

This reference will help you:
http://www.castleproject.org/monorail/documentation/trunk/usersguide/views.html


2012/4/12 Cesar Lopez <nica...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Castle Project Users" group.
To post to this group, send email to castle-pro...@googlegroups.com.
To unsubscribe from this group, send email to castle-project-u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en.



--
Ricardo

Apatira Lookman

unread,
Apr 12, 2012, 8:39:27 AM4/12/12
to castle-pro...@googlegroups.com
Use a propertybag to pass value to view

> --
> You received this message because you are subscribed to the Google Groups
> "Castle Project Users" group.
> To post to this group, send email to castle-pro...@googlegroups.com.
> To unsubscribe from this group, send email to
> castle-project-u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/castle-project-users?hl=en.
>
>

--
Sent from my mobile device

Apatira Lookman
Chief Technology Officer
VERTIGO-SOFT SOLUTIONS
+2348028400104

Cesar Sanz

unread,
Apr 12, 2012, 10:29:19 PM4/12/12
to Castle Project Users
Hi.. thanks for the answer.. I already know that I can put the value
into de PorpertyBag,..
but the problem is that I need to be able to show that value in
multiple views.. (multiple vm files)
and that value, the one I put into the session, is only avaible when
the user logs in...

Any Idea?

On 12 abr, 06:39, Apatira Lookman <apat...@gmail.com> wrote:
> Use a propertybag to pass value to view
>

Apatira Lookman

unread,
Apr 13, 2012, 5:47:19 AM4/13/12
to castle-pro...@googlegroups.com
Use a basecontroller

torobravo

unread,
Apr 17, 2012, 10:05:56 PM4/17/12
to Castle Project Users
You can use the '$session' variable of the context added automatically
by the NVelocityViewEngine.

So for your particular example you could use the following sentence in
your .VM file:

$session.sessionUser.userName

Regads,

torobravo

unread,
Apr 17, 2012, 10:13:07 PM4/17/12
to Castle Project Users
You can use the '$session' variable of the context added automatically
by the NVelocityViewEngine.

So for your particular example you could use the following sentence in
your .VM file:

$session.sessionUser.userName

Regads,

> >              +2...       - Hide quoted text -
>
> - Show quoted text -

Cesar Lopez

unread,
Apr 19, 2012, 12:32:17 PM4/19/12
to castle-pro...@googlegroups.com
Thanks torobravo.. I was trying $session['"sessionuser'].username and did not work..
will try  $session.sessionUser.userName
nos vemos en bancamovil :-P
Reply all
Reply to author
Forward
0 new messages