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 953503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:03:44+00:00 2026-05-16T00:03:44+00:00

when I use <c:out value=${track}> in a jsp, where should the attribute track be

  • 0

when I use <c:out value="${track}"> in a jsp, where should the attribute track be located in (servletContext, httpSession and request)?

I tried to have a controller to set the attribute track to the httpSession, but then ${track} doesn’t give me anything in the .jsp. On the other hand, if I set it to the servletContext, ${track} give me the value. It doesn’t seem right. Can you give a direction on passing attributes between .jsp (using jstl) and controllers (.java)? Thanks in advance.

  • 1 1 Answer
  • 0 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-16T00:03:45+00:00Added an answer on May 16, 2026 at 12:03 am

    It will under the hoods use JspContext#findAttribute() to find the attribute. The linked javadoc mentions the following:

    Searches for the named attribute in page, request, session (if valid), and application scope(s) in order and returns the value associated or null.

    So, it will return the first non-null value which is found after searching in the order of page, request, session and application (servletcontext) scopes.

    If you have attributes with the same name in multiple scopes and/or you’d like to get the attribute from a specific scope, then you can access it by the attribute maps available by the ${pageScope}, ${requestScope}, ${sessionScope} and/or ${applicationScope}. E.g.

    ${requestScope.track}
    

    See also:

    • Our EL wiki page
    • How to access objects in EL expression language ${}

    Back to your actual problem: if you have problems with accessing session scoped attributes, then it can only mean that the JSP is not using the same session as the servlet is using. You can debug it by printing the Session ID in servlet as follows

    System.out.println(session.getId());
    

    and in JSP by

    ${pageContext.session.id}
    

    Both should print the same. If not, then it is definitely not sharing the same session. The session is domain, context and cookie dependent.

    You can display all available session attributes by just printing ${sessionScope}. It will display a string in format as described in AbstractMap#toString(), containing all session attributes.

    ${sessionScope}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok, i have a need to be able to keep track of value type
I can't figure out a use case for being able to annotate interfaces in
What makes Python stand out for use in web development? What are some examples
In c#, I use a decimal out DbParameter for a Sql Server stored procedure.
I'm trying to use tasklist to find out which process is consuming more than
I need to cut out and save/use part of a string in C#. I
I'm trying to figure out how to decide when to use NSDictionary or NSCoder/NSCoding?
I'm hoping to find out what tools folks use to synchronize data between databases.
Is there a library out there which I can use in my current ASP.NET
I am trying to find out how to use usercontrols in asp.net mvc. I

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.