• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

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]
 
Once upon a time there were three bears. And they were visted by a golden haired tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic