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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:54:41+00:00 2026-06-13T21:54:41+00:00

I have a map userDetailsMap<String,List<String>> available in my jsp. And eligibleUser,notEligibleUser,enrolledUser are the keys.

  • 0

I have a map userDetailsMap<String,List<String>> available in my jsp.
And eligibleUser,notEligibleUser,enrolledUser are the keys.
I can easily check for the key inside s:iterator tag.

Like(This code is working) :

<s:iterator var="userDetailsMap" value="context.userDetails">
            <s:if test="%{#userDetailsMap.key=='eligibleUser'}">
            //some code
            </s:if>
            <s:if test="%{#userDetailsMap.key=='notEligibleUser'}">
            //some code
            </s:if>
            <s:if test="%{#userDetailsMap.key=='enrolledUser'}">
            //some code
            </s:if>
</s:iterator>

But how I check that a particular key is present or not?
I have used :

1.

<s:if test="%{#userDetailsMap['eligibleUser'] == null}">
//some code
</s:if>

2.

<s:if test="%{#userDetailsMap.containsKey('eligibleUser')}">
//some code
</s:if>

But both of them didn’t work.
Please suggest me.

  • 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-13T21:54:42+00:00Added an answer on June 13, 2026 at 9:54 pm

    EDIT: based on your statement that your iterator works,

    this is working (tested):

      <s:if test="context.userDetails.containsKey('eligibleUser')">
            //some code
      </s:if>
    

    If your userDetail is exposed through a getter directly by the Action, then use

      <s:if test="userDetails.containsKey('eligibleUser')">
            //some code
      </s:if>
    

    I’m assuming that UserDetails is the bean containing the authenticated user’s “badge”, and the three List inside the map are the Use Cases grouped by their User Role.

    In this case, to print all the Use Cases based on the User Role of the authenticated user, without even knowing the keys of the roles, use:

        <s:iterator value="userDetailsMap">
            User Role: <s:property value="key" />
            <br/>
            <ul>
                <s:iterator value="value">
                    <li>
                        Use Case: <s:property />
                    </li>
                </s:iterator>               
            </ul>
        </s:iterator>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So lets say I have: map<pair<int, MyEnum>, string> myMap; and I add a key
I have a map<string, list<int> > which I want to iterate over the list
I have map with key and value and my goal is to get list
I have map of groups. Each groups have list of players: Map<String, List<Player>> playerByGroup
I have map where each key is a String. To access a value I
I have a Map and a List . The List should be sorted based
I have image map that can I move, but this map will be so
I have Map<String,String> in java like this : {card_switch=Master, issuing_bank=ICCI, card_Type=DebitCard} I'm using the
I have a Map containing Strings for keys and Lists as values. After putting
I have Map <A, List<A>> map = new HashMap<A, List<A>>(); Say I want to

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.