Yes- that is correct. But unfortunatelly
The reason is not to prevent double submission, but hiding query-parameters (see also explanation of use case at the end)
does not work with the redirect - It even does not work without redirect (from action-phase to render phase / at least in my case ).
I made a couple of test.
I put a second searchBox on my page, both call the same component. The form is submittet by post:
In “doAction” I put the following lines:
response.setRenderParameter("test", "set test by response.setRenderParameter");
request.setAttribute("test2", "set test2 by request.setAttribute);
Then in doBeforeRender I try to get them with:
works - but only for the one component, which did the post!
With redirecting, even that does not work!
I took a look at what BaseHstComponent#sendRedirect does!
It calls HSTResponseUtils#sendRedirect at at the end this class calls
I can not detect where attributes are passed with the redirect. I know 2 approaches with Spring .
- return a RedirectView Object alog with RedirectAttributes
- return a ModelAndView object along with a ModelMap
The only way I found was to add queryParams to the redirect- but that ends up in url-Parameters -what I would like to prevent.
Maybe to better understand I explain the use case:
Different to the “out the box” - implementation of the search-component, where a form with a query-string input, submits to a searchg-page by a get request. So the query-string is submitted as an url-parameter.
I would like to add additional query-parameters, from ComponentInfo and user-input!
I would like to hide these query-parameters. Thererfore I need to do a post-request.
With that approach I can put the search-box on different pages- with different configuration, so that the user can perform a scoped search, with a unique user-experience