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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:19:45+00:00 2026-06-14T08:19:45+00:00

How do I enhance the Controller below to utilize Spring MVC’s Flash Attributes? The

  • 0

How do I enhance the Controller below to utilize Spring MVC’s Flash Attributes? The use case is a copy function.

POST/REQUEST/GET implementation:

  1. client clicks “copy” button in the UI
  2. server sets the response “Location” header
  3. client redirects to “path/to/page?copy”
  4. server provides ModelAndView
  5. client (jQuery success function) sets window.location

FooController redirect method:

@RequestMapping(value = "{fooId}", method = POST, params = { "copy" })
@Transactional
@ResponseStatus(CREATED)
public void getCopyfoo(@PathVariable String fooId, 
HttpServletResponse response, RedirectAttributes redirectAttrs) {
    response.setHeader("Location", uriPath);
    //no worky?!:
    redirectAttrs.addFlashAttribute("barKey", "barValue");
}

FooController get method:

@RequestMapping(value = "{fooId}", method = GET)
@Transactional(readOnly = true)
public ModelAndView findFooById(@PathVariable String fooId, 
HttpServletRequest request){ 
    Map<String, ?> map = RequestContextUtils.getInputFlashMap(request);
    // map is empty...
    return modelAndViewFromHelperMethod();
}
  • 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-14T08:19:47+00:00Added an answer on June 14, 2026 at 8:19 am

    I’m affraid that RedirectAttributes work only with RedirectView,
    so Your controller should return for example:

    1. String: "redirect:/[uriPath]"
    2. new RedirectView([uriPath])
    

    If you realy need to handle server response with JS, then maybe handling HTTP status 302 would help.

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

Sidebar

Related Questions

I am attempting to enhance a internal web application we use. I am using
I have been attempting to enhance my GUI system written in Java to use
I have a WinForms utility that I use constantly, and enhance regularly. Roughly one
I want to use cairo to enhance gtkentry look. For this, I have connected
I have been attempting to enhance my GUI system written in Java to use
I am trying to test my Controller - Secure.java. I use play's Fixtures class
I want to enhance my tool's page where as soon use click a button.
I am trying to enhance my spring-enabled web-app's security using Apache Shiro and am
To enhance performance and resources, I've just started to use getRows() on a few
I'm looking to enhance the layered navigation in Magento. Presently, attributes that are used

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.