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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:00:37+00:00 2026-06-01T08:00:37+00:00

I am adding to the ModelMap a Map which contains a list to go

  • 0

I am adding to the ModelMap a Map which contains a list to go on a drop down an I am populating the ModelAttribute when the form initialises:

@RequestMapping(method = RequestMethod.GET)
    public String initForm(HttpServletRequest httpRequest, ModelMap model)
    {
        model.addAttribute("myList", myMap);
        return "MyForm";
    }

It works as expected however when the user submits the form this list is lost from the map.

@RequestMapping(method = RequestMethod.POST, value ="/dosearch")
    public String processSearch(... ModelMap model)
    {
                .....
    return new ModelAndView("MyForm",model);

This approach above doesn’t work.

How can I prserve the map between form submits?

  • 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-01T08:00:39+00:00Added an answer on June 1, 2026 at 8:00 am

    No. Even a flash scope won’t help you here, because you are not using redirect-after-post. Here are the options:

    • output all values in the html form, then they will be submitted to /dosearch and you’ll be able to get them from the request
    • use the session to store the values (worse option)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Adding an element to the head of an alist (Associative list) is simple enough:
Adding functionality to a class can be done by adding a method or by
Adding some gui modifications and I want to have a button which is 10pixels
When adding controls to a form at runtime, you can do either of the
After adding a ribbon item, or calling a method that updates an item, the
After adding ASIHTTPRequest to my project (which incidentally I've now removed) I get linking
Adding a list item via the SharePoint web service model, any idea how to
Im adding textboxes (not a fixed number of textboxes) dynamically to a form on
Adding a new Form in the project creates a default form with default properties.
In Adding individual arrows in multiple plots I described a problem which has been

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.