aspose file tools*
The moose likes JSP and the fly likes need to submit external form from my jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Reply locked New topic
Author

need to submit external form from my jsp

Stephen Huey
Ranch Hand

Joined: Jul 15, 2003
Posts: 618
I'm modifying a JSP/servlet site that I didn't develop, so I'm kind of new to this. I'm trying to pull contact info from a bean on my site, and I can do that just fine. I need to use it to submit a form on another website's webpage (done in ASP, but I don't think that matters). I wanted to populate the text fields on that external form, but I don't think that's possible, b/c in the source those fields' values are hardcoded like this:
value=""
If you know of any way to trick it, I'm all ears. Meanwhile, my preference was to populate the fields and not submit it so that users could view the info before submitting, but that's not necessary, b/c the next page is a confirmation page (so I'm assuming I can post the form data from within my Java code and so just take my users straight to that external confirmation page).
For another project, I used the Apache Common HTTPClient, but in this case, I'd rather not, b/c I don't yet even know how to compile all the site (I only know how to make changes to the JSPs). I figure it should also be pretty easy to submit a form in JSP, even if it's on another site. Am I right? I'm not sure how to, though--it seems a little bit hairy, especially the part where I need to open up that confirmation page after submitting the form. Do I just use GET or POST to submit a form and have the HREF include target='_blank', or is it a bit trickier than that? If you have a good idea about how to code this, I'd love to see it!
Thanks,
Stephen
Dana Hanna
Ranch Hand

Joined: Feb 28, 2003
Posts: 227
Wow - I have no clue what you are trying to do. Perhaps a better explaination and some sample jsp/asp would help! There are many "tricks", but I don't want to jump the gun and mislead you!
Juan Rolando Prieur-Reza
Ranch Hand

Joined: Jun 20, 2003
Posts: 235
Originally posted by Stephen Huey:
wanted to populate the text fields on that external form, but I don't think that's possible, b/c in the source those fields' values are hardcoded

This seems familiar. If I can paraphrase your problem:
Your new JSP application wants to send data to a pre-existing
application that you cannot change and cannot see its source code.
One tricky solution is to make your new application
construct the HTTP code, containing your
new application's data, and send that (HTTP code) to the external application. Then similarly listen for its HTTP response.
That application will see and transmit exactly what it normally
does when a person interacts with its forms. But this is very tricky.
If your problem is actually that you CAN make a few changes to the old application in order to make your new application communicate with it better, here's another approach.
What ever data you need to get from the old form, put it into the session
object. Your new application should forward to the old app form so that
they then share the same session object. As a result, your new app can
get and set values in the session object that the old will also see.
- just a humble suggestion.


Juan Rolando Prieur-Reza, M.S., LSSBB, SCEA, SCBCD, SCWCD, SCJP/1.6, IBM OOAD, SCSA
Stephen Huey
Ranch Hand

Joined: Jul 15, 2003
Posts: 618
I've kind of changed my question (clarified it), and am continuing the discussion here:
http://www.coderanch.com/t/283204/JSP/java/trying-submit-form-another-site
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: need to submit external form from my jsp
 
Similar Threads
override value="" ???
refreshing a form with bean values when returning to jsp
*display* passed values in webpage form
trying to submit form on another site from my JSP
passing parameters with LookupDispatchAction