• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

Accessing JSP implicit objects from outsite the JSP page itself

 
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
 
Marshal
Posts: 67366
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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
Marshal
Posts: 67366
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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.
 
Not so fast naughty spawn! I want you to know about
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!