• 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

Accessing userPrincipal via EL - why doesn't this work?

 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I can print out the principal like this:


This doesn't work:


But this does:


Can someone explain why the 2nd doesn't work please?

Thanks,

Ed
 
Ranch Hand
Posts: 453
Google Web Toolkit Hibernate Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
request is not an implicit object for El that's why it is happening. you can access the actual jsp implicit object reference "request" using pageContext.request
and userPrinciple is a property of request here
avi sinha
 
Edward Winchester
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

avi sinha wrote: request is not an implicit object for El that's why it is happening. you can access the actual jsp implicit object reference "request" using pageContext.request
and userPrinciple is a property of request here
avi sinha


Thank you. I continually get confused with the different methods.
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<c:out value="${requestScope.userPrincipal}"/>
whenever we use attributes from request or session, EL uses requestScope or sessionScope to map the same. The above EL expression should work
 
Edward Winchester
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

anand chouti wrote: <c:out value="${requestScope.userPrincipal}"/>
whenever we use attributes from request or session, EL uses requestScope or sessionScope to map the same. The above EL expression should work


Actually, it doesn't work. I tried it before you posted. I was going to ask why but thought I'd plough through the docs instead. Now we're on the topic, anyone know why?

Thanks,

Ed
 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

anand chouti wrote: <c:out value="${requestScope.userPrincipal}"/>
whenever we use attributes from request or session, EL uses requestScope or sessionScope to map the same. The above EL expression should work


Nonsense. Request scope and the request instance are not the same thing.
 
You’ll find me in my office. I’ll probably be drinking. And reading this 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