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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:17:08+00:00 2026-06-03T13:17:08+00:00

I have a HashMap<Long, ClientProperties> that I’m putting on the ServletContext at startup. //During

  • 0

I have a HashMap<Long, ClientProperties> that I’m putting on the ServletContext at startup.

//During application-startup:
//getProperties() returns HashMap<Long, ClientProperties>
context.setAttribute("clientProps", clientManager.getProperties());    

ClientProperties is a POJO with 5 attributes that i need to access in my jsp.
Basicly I need to get the correct POJO (by HashMap-key) and access its properties in my jsp.

More spesific (for example purposes), one of the POJO attributes is clientLogo
In my jsp i now have:
<img src="<c:url value='/images/logo.png'/>" alt="Logo">

I need to replace the path to the logo-file with the clientLogo-property of the POJO.
The HashMap-key to use should be extracted from the User-object stored in the session. It can be retrieved like this: ${sessionScope['user'].clientId}

Any ideas?
Using struts2 and spring btw if that matters.

  • 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-06-03T13:17:10+00:00Added an answer on June 3, 2026 at 1:17 pm

    To get an attribute foo from the servlet context, you use the same syntax as to get it from the session, but replace sessionScope by applicationScope.

    But you have so many nested things here that you should define variables:

    <c:set var="map" value="${applicationScope['clientProps']}"/>
    <c:set var="mapKey" value="${sessionScope['user'].clientId}"/>
    <c:set var="pojo" value="${map[mapKey]}"/>
    <c:set var="clientLogo" value="${pojo.clientLogo}"/>
    
    <c:url value="${clientLogo}"/>
    

    Note that this is typically the kind of hard work that you should not have to do in the view. Implement the retrieval of the image path in the controller, in Java, and make it available as a property of your action/form, and access it directly from your view.

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

Sidebar

Related Questions

I have a HashMap that I'm using in Processing and I'd like to increment
I have a hashmap that contains multiple string arrays. I am trying to output
I have a HashMap with the addresses and the names of the clients that
If I have a HashMap that looks like this: HashMap<String, MyObject> where the String
I have a HashMap<String,String> and there is a static method which returns this map
i have a big problem... i have this map HashMap<Long, String> examValues; It gets
I have a simple class that contains a hashmap: @XmlRootElement() public class Customer {
I have a hashmap of the type HashMap<Long, ArrayList<String>> . I need to override
I have a HashMap that contains 12 million entries. It maps String values to
I have such code: HashMap<Long, TempPosition> positions = getTempPositions(); for (SortedMap.Entry<Long, TempPosition> p: positions.entrySet())

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.