File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes EL Function question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "EL Function question" Watch "EL Function question" New topic
Author

EL Function question

Ken Harris
Greenhorn

Joined: Aug 31, 2010
Posts: 8

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.


Ken Harris
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61221
    
  66

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ken Harris
Greenhorn

Joined: Aug 31, 2010
Posts: 8

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EL Function question