• Post Reply Bookmark Topic Watch Topic
  • New Topic

Accessing JSP implicit objects from outsite the JSP page itself

 
Sa'eed Waseem
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello there,

I have a quick question..

I know you can access a JSP implicit object inside the JSP page using scriplets...such as



now my question is, can this request object be accessed from somewhere else outsite the JSP page. Specifically, I am developing custom tags (i am new to this but have some fundamentals), ie from inside the doTag() in my TagHandler.java class (which extends SimpleSupport)...from withing that method, i want to access the JSP implicit objects, precisely the request and session ones.

Is this possible? if yes, how? (a code snippet will be helpful)

if impossible, what's the logic behind blocking access to these objects specially from within tag handlers? I mean custom tag handlers do tasks on behalf of custom tags inside the JSP page, so it would be logical for these handlers to have access to these implicit object (this is simply my speculation on the matter)


thanks in advance
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't need to bother with the JSP implicit objects. Within a tag handler, the tag support classes give you direct access to things like the request and session.
 
Sa'eed Waseem
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the response Bear.

but can you give me an example.

I mean where do i get the reference to these objects from? JspContext or where exactly?


thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The clue that trips up most people is the the jspContext is really an implementation of PageContext. Once you have that, you have access to just about everything.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!