• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Freemarker: session object

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How can I access the session object? In the former template it was widely used and I could easily use the following statement:

<#if logged && session?exists && (session.isAdmin() || session.isModerator())>

But now the following error comes up:
freemarker.core.InvalidReferenceException: Expression session is undefined on line 66, column 162 in docware/header.htm.

Funny enough in the bottom.htm you aswell use the session object..
<#if session?exists && session.isAdmin()>

So.. uhm... how can I validate if a user is moderator / admin now?
[originally posted on jforum.net by Sid]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"session" is always available. It is an instance of UserSession. It is included in JForum.java, line 196, and if bottom.htm uses it, all other templates can use it as well.

Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I found the actual error. The reason is changed behaviour in application logic, allowing module/action to be an array. I've modified my code for redirection and now it seems to work. The failure messages were very irritating ...
[originally posted on jforum.net by Sid]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic