I am using struts 1.2.7 version and working on application which is going to call payment gateway url.
Hence, as a security reason, I have to send all data to payment gateway using POST method.
I am not sure , how I can achieve same using struts.
Currently , what I have done is i have created simple jsp(shown below) on which I am first putting all parameters in hidden and set payment gateway url dynamically as action in form tag using normal scripting , and on body load, I am submitting the form.
Can I do the same using struts.
I tried to search on google, but what answers I got is <logic:redirect>. But I think , it will not be helpful in submitting form using post.
Kindly help me with sample code or please confirm that it is possible or not possible.
I think you should call the payment gateway from Struts action or class where you business logic resides.Second thing its the same in struts as in servlet.
Please refer to following links which uses httpclient and java.net.url to send request to paypal.
Joined: Sep 05, 2012
thank you very much for replying to my different posts..
In this case, my issue is when I have to call payment gateway, control is going to be transfered to payment gateway site.
Hence I think calling payment gateway from server side , will not be possible. i.e. using java.net.URL which you are suggesting.
Please let me know if i am thinking on right track or not.
I think you will be able to do it, As once the request is generated through your servlet wiht httpclient or url.net package it will go to the payment gateway so it will transfer the controll to payment gateway. try to check it with the test page provided by the payment gateway. They provide the test page where you can check the proepr integration with the payment gateway with dummy card number.
Once the payment has been made the payment gateway will return the necessary data back to your application which you need to store it in your database.
Joined: Aug 30, 2012
Yes Jatan is right. Once the transaction is successfull, it returns some data back with which you can verify the success or failure of the transaction.