Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3339728
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:31:34+00:00 2026-05-18T00:31:34+00:00

I’ve examined various questions about taglibs and implicit objects here. While many of the

  • 0

I’ve examined various questions about taglibs and implicit objects here. While many of the answers present interesting ideas, I haven’t been able to find one that answers this question directly.

So to illustrate my dilemma, say I have a Java class that implements the javax.servlet.jsp.tagext.Tag interface…

import javax.servlet.ServletRequest;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.Tag;

class MyTag implements Tag {
    private PageContext _pageContext;

    public void setPageContext(PageContext pageContext) {
        _pageContext = pageContext;
    }
    .
    .
    .

This gives me access to a PageContext object, which provides some useful information about the calling JSP. Problem is, PageContext doesn’t seem to provide access to many of the JSP’s actual implicit objects…

.
.
.
public int doEndTag() throws JspException {
    ServletRequest req = _pageContext.getRequest();
    .
    .
    .
    return EVAL_PAGE;
}

The ServletRequest object depicted above is quite different from HttpServletRequest, which is implemented by the implicit object “request” in the JSP itself. This makes calling such handy methods as HttpServletRequest.getRequestURI() problematic inside my class.

So from reading the answers to several other questions here, I’m left with the impression that there is no out-of-the-box way of getting at the actual implicit objects. I either have to pass them explicitly as attributes of the custom tag in my JSP…

<mc:mytag request="<%=request%>"/>

…or perhaps store them in the hash of some other implicit object I do have access to…

<% session.setAttribute("request", request); %>

Which, if true, naturally leads me to the question… are you friggin’ kidding me?? There’s got to be something key that I’m missing here. Access to the JSP’s implicit objects seems like such a reasonably common thing for me to want in my custom taglib classes. It strikes me as immensely kludgy to have to take such steps every time I require them — especially when I’m being passed something like the PageContext object that could conceivably provide them for me, but doesn’t seem to.

I really feel like I’m missing something basic here, but I can’t for the life of me figure out what that might be. Can someone shed some light on this?

  • 1 1 Answer
  • 3 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T00:31:34+00:00Added an answer on May 18, 2026 at 12:31 am

    The PageContext does give you access to the current HttpServletRequest, you just need to cast it:

    HttpServletRequest req = (HttpServletRequest )_pageContext.getRequest();
    

    This isn’t great, but dates back to a time when people thought there might one day be non-HTTP stuff in the Servlet API.

    As for the use of the term “implicit objects”, this only makes sense within the context of the JSP page itself. The term has no meaning beyond that. The “implicit object” representing the current HttpServletRequest is the same object you get from the PageContext.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
I know there's a lot of other questions out there that deal with this
I don't have much knowledge about the IPv6 protocol, so sorry if the question
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.