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

  • Home
  • SEARCH
  • 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 7679277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:50:28+00:00 2026-05-31T17:50:28+00:00

I have researched enough on this topic sans any luck :-( My requirement is

  • 0

I have researched enough on this topic sans any luck 🙁

My requirement is to load a HashMap that is declared in the action class from the jsp form that has a s:select tag.

Here is my action class

public class AttributeAction extends ActionSupport {
    private HashMap<String, String> lstAttrTypesHashMap;
    public void setLstAttrTypesHashMap(HashMap<String, String> lstAttrTypesHashMap) {
        this.lstAttrTypesHashMap = lstAttrTypesHashMap;
    }

    public HashMap<String, String> getLstAttrTypesHashMap() {
        return lstAttrTypesHashMap;
    }

    public String renderPageAction() {
        lstAttrTypesHashMap.put("ENTRY1", "VALUE1");
        lstAttrTypesHashMap.put("ENTRY2", "VALUE2");
        lstAttrTypesHashMap.put("ENTRY3", "VALUE3");
        return SUCCESS;
    }

    public String searchAction() {
        logger.info("***************************************");
        logger.info("searchAction Started ...");
        logger.info("a.getType() = [" + a.getType() + "]");
        logger.info("getLstAttrTypesHashMap() = [" + getLstAttrTypesHashMap() + "]");
        return SUCCESS;
    } 
}

here is how I show the drop down in the jsp

<s:select 
  key="a.type" 
  label="Select Object Type" 
  name="a.type" 
  list="lstAttrTypesHashMap" />

Here is the struts.xml

<action name="attributeSearch" method="searchAction" class="com.frk.gid.action.AttributeAction">
    <result name="success">/AttributeResult.jsp</result>
    <result name="input">/AttributeInput.jsp</result>
</action>
    <action name="attributeRender" method="renderPageAction" class="com.frk.gid.action.AttributeAction">
    <result name="success">/AttributeInput.jsp</result>
</action>

When the above jsp loads, I can see that the drop down is populated fine. However when I submit it back to the action, i can only see the selected value (a.type) . The hashmap happens to be null. Is there anything else I need to do to get this HashMap loaded? My understanding was Struts2 would automatically load the HashMap from the dropdown on submit – apparently not … appreciate any input !!!!

  • 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-31T17:50:29+00:00Added an answer on May 31, 2026 at 5:50 pm

    Thanks very much for your responses !

    Finally I decided to go with passing Hidden variables and it worked like a charm.

    Also, I had complex types like Map>, I had to write my own Type Converter to convert from and to String.

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

Sidebar

Related Questions

Greetings, Apologies in advance that I have not researched this toughly enough to answer
I have A WCF service that has a class that inherits System.Web.Security.RoleProvider. In this
I have researched this for a few hours and I am kind of frustrated.
I have requirement as following like showing ABPeoplePickerNavigationController in tabbar based application. I researched
I have researched and researched and I am trying to use jquery to refresh
I have researched a lot about creating my own app for android with a
I have researched how to manually include a PlaceHolder Text in UITextView (as there
Windows Forms and Navigation I have researched and read many different web articles and
I researched over the internet, but could not find anything... I have a mysql
I have a code. But, due to my limited knowledge. i researched and realised

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.