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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:01:34+00:00 2026-05-28T03:01:34+00:00

I can access a HashMap<String, Object> easily enough in JSTL but is it possible

  • 0

I can access a HashMap<String, Object> easily enough in JSTL but is it possible to access a HashMap<Object, Object>

I only ask because I don’t receive any errors (or output) when trying the following:

${myHashMap[anObject]}

It leads me to believe that myHashMap is trying to find my value but it is somehow not evaluating anObject as the correct key. I can verify that myHashMap has anObject as a key with a (non-blank/non-null) value that should display.

  • 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-28T03:01:35+00:00Added an answer on May 28, 2026 at 3:01 am

    This syntax ought indeed to work. I understand that you didn’t get any value by the given object as key although you’re confident that the desired object is in there? In that case, the class as represented behind ${anObject} in your code must have the equals() (and hashCode()) methods properly implemented. The Map#get() namely tests the key by equals() method. See also the javadoc:

    Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.

    More formally, if this map contains a mapping from a key k to a value v such that (key==null ? k==null : key.equals(k)), then this method returns v; otherwise it returns null. (There can be at most one such mapping.)

    In other words, if the equals() of your ${anObject} returns true for the map key, then the associated map value will be returned, otherwise null will be returned and EL will then print nothing.

    That it works for String is simply because that class has the equals() already properly implemented.

    See also:

    • Right way to implement equals contract
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In spring, I can do like this Map<String, Object> model = new HashMap<String, Object>();
I can access and show self.view and see the frame in the log but
I know you can access the Contact Store from the SDk, but is it
Is there any way i can access the page object from within the global.asax
I can access other MXBean types, such as the RuntimeMXBean, but not the GarabageCollectorMXBean:
I've been gradually piecing together how I can receive a serialized object within Spring
I can access the database either from a .NET program (using ODBC) or through
I can access Spring beans in my Servlets using WebApplicationContext springContext = WebApplicationContextUtils.getWebApplicationContext(getServletContext()); in
How can hibernate can access a private field/method of a java class , for
Can anyone let me know how can access an element of a list that

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.