• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

submit form to external url using struts

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am back with one more question.

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.

 
Ranch Hand
Posts: 300
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Vishal,

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.

Regards
Jatan
 
vishal Mestri
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi jatan,

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.

Regards,
Vishal
 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Vishal,

For calling external links from struts application like any payment gateway, you are on the right track.
Make use of java.net API or HttpClient API.

Thanks and Regards,
Ashwini Kashyap | [email protected] | www.infocepts.com
 
vishal Mestri
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ashwini,

thanks for reply.

But what I tried to convey in earlier email was I can not use java.net.URL or Http Client api, as control has to be transferred to Payment gateway pages.

I think it would not be possible that first I call payment gateway url from server side using HTTP Client api. If I do that, i will not be able to transfer control to payment gateway.

I hope , you understand what I want to convey.

Regards,
Vishal
 
jatan bhavsar
Ranch Hand
Posts: 300
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi vishal,

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.

Regards
Jatan
 
Ashwini Kashyap
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

Thanks and Regards,
Ashwini
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic