Reputation: 61
I have My request parameters in the URL of current page. When I click on submit in the same page, parameters lost got lost in the new request. How to retain the request parameters even after submitting the form?
Upvotes: 1
Views: 6360
Reputation: 164766
If submitting the form via POST, you can include request parameters in the form's action
attribute, eg
<form method="post" action="action?id=123&foo=bar">
<input type="text" name="baz">
<input type="submit">
</form>
Upvotes: 1
Reputation: 6490
What you are asking for is state management. It can be done in several ways
Hidden fields is an easy way to do it; although the HTML can get more lengthy. I personally prefer HttpSession.
Upvotes: 0
Reputation: 6417
Upvotes: 1
Reputation: 69905
You can read the query params from the url and add them as a hidden fields into the form you are submitting. This will send the query string params along with the form.
Upvotes: 2