my dog learned polymorphism
The moose likes Servlets and the fly likes invisible intermediary servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "invisible intermediary servlet" Watch "invisible intermediary servlet" New topic

invisible intermediary servlet

sean divine

Joined: Oct 27, 2005
Posts: 14
Making my first attempt at a web shopping cart. I've got the cart working and now need to pass the cart values to paypal. The order info and cart items are passed to paypal using a form with method "post".

The problem is that I want to capture these request values between the customer's cart page and paypal. I could do this by sending the customer to an intermediary page and having them click "next" to take them to paypal. But I don't want the customer to have to see one more unecessary page and make one more unecessary click.

What I'd like would be to have the form send the request values to a servlet that would capture and act upon the values before automatically redirecting everything to paypal. The customer should be unaware that this intermediary servlet exists.

This shouldn't be too difficult but I can't think of how to do it with my limited knowledge of servlets.

Any suggestions would be greatly appreciated.
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42958
You don't have to have the user click on a button, as long as they have JavaScript enabled. Just return a page saying "thank you, we're now taking you to paypal, bla bla", and in the onLoad handler you submit a hidden form on the page to PayPal. If JavaScript is off, the user would still click the button, though.
sean divine

Joined: Oct 27, 2005
Posts: 14
Thanks for the tip. I'll give it a try.
I agree. Here's the link:
subject: invisible intermediary servlet
It's not a secret anymore!