We have a form at client side. When user fills the details and clicks on submit button then the rest api called which process the data and stored in database. Now what I want is user should redirect (POST method) to third party payment gateway page from server itself with required parameters, also I don't want to use query parameter string because its visible to user. I know there are two ways of doing it,
Using sendRedirect method :
For redirection I used resp.sendRedirect("paymentgateway url"); but the problem with redirect method is that the post parameters are not sent to payment gateway.
Posting form with hidden fields :
The payment gateway redirection should be done via posting form with hidden fields but I don't know how to do it at controller level.
<form method="post" action="paymentgateway url">
<input type="hidden" name="txnid" value="98765">
<input type="hidden" name="amt" value="100">
</form>
Also I want to show the user loading page after he clicks submit button.
Any help will be appreciated!