Hi i'm developening a struts application and i want to make my jsp according users permissions. For example i would like to hide a link to another jsp if the user doesn't have permission to see it.
Does anyone know a pattern or a tag lib to do this automatically? i'm looking for a better way than calling a method (something like isAuthorized() ) from a created object inside every jsp i have. I also don't want every link in my jsp beeing inside an if statement.
One possible solution might be to develop your own custom tag that encapsulates your authorization logic. Example:
I know you said you didn't want everything inside an if statement, but there has to be some conditional logic in there somewhere. At least with a custom tag it's more readable. [ October 20, 2007: Message edited by: Merrill Higginson ]
Merrill makes the correct suggestion. You could also use some existing libraries such as logic resent and logic:equals to accomplish the same thing if you're not keen on creating custom taglibs. Just a thought. However, the custom library is the right way to go if you have the time. Hope this helps.
subject: Hide resources according user permissions