Can I tell spring to ignore request parameters?

If I submit this form:

<form id="confirmForm" method="POST">
    <input type="hidden" name="guid" value="guidval"/>
</form>

to this url:

/AltRT?guid=guidval

maps to this controller method:

@RequestMapping(method = RequestMethod.POST)    
public String indexPost(@RequestParam String guid)

I get both values ​​for my guid. So the value guidis equal guidval,guidval. I would like to get only the value from the form.

Is there a way to tell Spring to ignore query string parameters?

EDIT for further clarification: the query string is left from another (get) request. Therefore, if I could clear the query string, that would also work. In addition, I do not want to edit the nameinput of the form, because I want this endpoint of the message to be available to other services without changing them.

+4
source share
1 answer

, ​​ HTTP POST, http://www.w3schools.com/tags/ref_httpmethods.asp

,

  • <form id="confirmForm" method="POST" action="AltRT">
        <input type="hidden" name="guid" value="guidval" />
    </form>
    
  • JSON, , @RequestBody Spring, URL-.

+1

Source: https://habr.com/ru/post/1589482/


All Articles