• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Posting a form to an external site

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let me see if I can explain this, so that it makes sense.

I have a fairly simple Struts based app that allows a user to populate a form. I want to post that form to an external site, not one within this web application. In the forward for my action, I can't use a redirect, because that results in the request containing the form data being destroyed. But if I don't redirect, I get a 404 Page not found error when it tries to forward to the external URL.

Am I missing something simple here?

Thanks
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's certainly possible to have a form generated by your application server that posts to another site. Unless there's some processing you have to do before posting to the external site, I wouldn't bother with an Action. Just have your form post directly to the external site. Here are a few suggestions:

1-You don't use <html:form> just use <form>

2-The action="" must specify a full URL including the http:// (e.g. http://www.yahoo.com).

3-Remember that there is no request object being passed to the external site, so all the information has to be in input fields on the form, either visible or invisible.
[ February 04, 2006: Message edited by: Merrill Higginson ]
 
Andrew McLaren
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, thanks for the reply.

Yes, it works fine with a plain old HTML form. Our architecture folks may have some issues with doing it that way, but at this point it doesn't look like there is much alternative.

Thanks!
 
reply
    Bookmark Topic Watch Topic
  • New Topic