Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EL Function question

 
Ken Harris
Greenhorn
Posts: 8
Java Linux Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have read everything I can find and cannot find a solution to this problem.

Is it possible for the java class defined by a custom tag to access the session scope? If so, how?

<function>
<name>hasPermission</name>

<function-class>mia.us.tags.PermissionsTag</function-class>

<function-signature>
boolean hasPermission(mia.us.data.UserDto, String)
</function-signature>

</function>

Given the method hasPermissions receives a user object and a permissions string like "ADD_PAYMENT". In the session is a variable called "ADD_PAYMENT" with a value of 97. From the class, I need to read the session variable and get the number, to pass to the user object to see if the user has this permission.

Is this possible, or do I need to convert it (read the session variable) before calling the method and pass the int value in?

Thanks in advance.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65220
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
EL functions are static functions that have no context on their own. You'll need to pass any info that is needed to the function. For example, pass the pageContext to the function and it will have access to the entire environment.
 
Ken Harris
Greenhorn
Posts: 8
Java Linux Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:EL functions are static functions that have no context on their own. You'll need to pass any info that is needed to the function. For example, pass the pageContext to the function and it will have access to the entire environment.


That's what I thought, but I was hoping for a different answer.

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic