Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

can pageContext.request be used to authenticate users?  RSS feed

 
Jeff Pollet
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

I have the feeling that the answer to my question is pretty simple, but I've been scouring JR for quite a while now, not to mention googling till my fingers have bled, and I can't find the answer to this question.

I have a jsp page with a form that has a dropdown menu. I want some options in the dropdown to appear to some users (based on their login to the webapp) but not to others. I can do this as a scriptlet, but I'd rather not. I also know how to do it using the jstl <req:isUserInRole> tag:


If I can get away with doing this without having to add the request-taglib library, I'd be happy. Is there another way of doing this sort of in-page authentication that filters content for different users in a jsp page? pageContext.request looks promising, but it doesn't seem to be able to get the userID...what am I missing?

If it matters, I am using Tomcat 5.0.

Thanks in advance for any help!
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jeff Pollet:
I also know how to do it using the jstl <req:isUserInRole> tag:


req:isUserInRole is not a JSTL tag. I suspect you are using one of the Jakarta 3rd-party tag libraries.

Because request.isUserInRole() is a general method, rather than a property accessor, the EL has no way to access it.

If you don't want to use the Jakarta tag, perhaps you could write your own? Or perhaps an El function?

Or, you could make the role determination in the page controller and set it in the request in an EL-friendly manner.

Or just perhaps, something in this older article might be of use.
[ August 13, 2007: Message edited by: Bear Bibeault ]
 
Jeff Pollet
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the suggestions, Bear. You've been helpful every single time I've posted here, even when you have to school me!

I'm in a bit over my head, obviously, but the article you linked to is full of great information. I'll start there and work on it some more.

Thanks again for your help.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!