> ... the problem is that as soon as the form is
> posted the result is returned to the browser
> and test.jsp no longer has control.
There may be two ways to handle this:
1) Jason Hunter's text poses the concept of Servlet chaining and filters...
something along these lines may work.
2) Alternatively, along the same line as the parser logic:
a. parse the <form> tag of forms 2 through n, placing the next form
url in a hidden var
b. redirect the form to your jsp for further processing, prior to
POSTing form data to
the next in the form series.
> ... some forms to external (internet) servers and
> I'm having problems ... the request for the page
> timesout and throws a "NoRouteToHostException"
> which I think is because it cant find it way
> through the firewall.
This sounds odd but, you're seeing it happen, so...
Perhaps you could map this one out and pose it to a different thread.
Someone may see what is happening...
Phil
-----Original Message-----
From: Paul Allton <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Thursday, March 23, 2000 8:35 PM
Subject: Re: Automatically Submitting Forms
>Thanks Phil,
>
>I implemented something similar to your first suggestion and used
javascript
>form.submit() to submit the form.
>This seems to work well - with two slight issues .....
>
>(1) It works fine for the first form, but if I want to fill in multiple
>forms in sequence (such as doing a registration or soemthing) then it
>becomes a problem - because the first form needs to keep control throught
>the whole process.
>
>i.e if test.jsp is the first form ... it needs to
> --- get form1.htm
> --- prefills and submits form1.htm
> --- parses the response ...
> --- get form2.htm
> --- prefills and submits form2.htm
> --- parses the response ...
> --- get form3.htm
> --- etc ...
>
>the problem is that as soon as the form is posted the result is returned to
>the browser and test.jsp no longer has control. Is there anyway to avoid
>this?
>
>(2) In testing I have actually been reading and posting forms on a local
>server. I just tried to auto post some forms to external (internet)
servers
>and I'm having problems ... the request for the page timesout and throws a
>"NoRouteToHostException" which I think is because it cant find it way
>through the firewall. How can I setup the URL connection to go through the
>firewall?
>
>----- Original Message -----
>From: Phil Campbell <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>; Paul Allton <[EMAIL PROTECTED]>
>Sent: Wednesday, March 22, 2000 5:08 PM
>Subject: Re: Automatically Submitting Forms
>
>
>> Paul:
>>
>> Something like this may work; we have a similar logic working elsewhere
>(on
>> code we control).
>>
>> As I understand your question, two implementations are possible. Both
>assume
>> knowledge of external html Form source code.
>>
>> FIRST IMPLEMENTATION: Automate form default values for user input.
>>
>> We use code that allows us to fill-in forms that we control. The
logic
>> seems applicable to any form code, following something like this pseudo
>> code:
>>
>> 1) JSP/Servlet opens second page url; reads source into local String
>> var, say strVar.
>> 2) Look for input vars (find strVar.indexOf( somevarname )
>> 3) Find positions of related html <input> tag (index of nearest < and
>>
>> tag delimiters)
>> 4) replace entire <input ...> tag with a <input name=... [value] >
>> string for somevarname
>> 5) send strVar as response to client
>>
>> SECOND IMPLEMENTATION: Automate second Form POST from first Form data
>(does
>> not require user input).
>>
>> (This would be like having form ONE capture information to be posted
>so
>> an external server, say as an automatic submission to Yahoo.com, for
>> example.)
>>
>> Simply create hidden html form with the new data and post it to the
>> external form server... (I think Real Gagnon
>> (http://tactika.com/realhome/realhome.html) discusses Post to a url. If
>not,
>> someone else here has posted information on how to do it -- check the
>> archives.)
>>
>> Your choice of languages for either of these implementations; Java is my
>> preferred choice -- much easier to do in Java than in C and I think
>> performance is comparable. ( Zhu Jiang suggested JavaScript; don't know
if
>> his idea is plausible and can find no reason to use client side
technology
>> in this application. Besides, this is a server side technology group ;-)
>>
>> If you need help or an example, let me know.
>>
>> Good luck.
>>
>> Phil
>>
>> -----Original Message-----
>> From: wee kb <[EMAIL PROTECTED]>
>> To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
>> Date: Wednesday, March 22, 2000 2:49 AM
>> Subject: Re: Automatically Submitting Forms
>>
>>
>> >Broken link!
>> >
>> >At 09:58 AM 3/22/00 +0200, Zhu Jiang wrote:
>> >>You can just use Java Script to do that work. check out Java Script
>object
>> >>road map you can find the answer.
>> >>
>> >>here is a link:
>> >>
>>
>>>http://developer.netscape.com/viewsource/goodman_ssjsrmap/goodman_ssjsrma
p
>> .h
>> >>tml
>> >>
>> >>
>> >>zhu jiang
>> >>
>> >>-----Original Message-----
>> >>From: EXT Paul Allton [mailto:[EMAIL PROTECTED]]
>> >>Sent: 19. March 2000 11:03 PM
>> >>To: [EMAIL PROTECTED]
>> >>Subject: Automatically Submitting Forms
>> >>
>> >>
>> >>I have a form and I want to collect some info on it and based on that
>info
>> I
>> >>then want to got to a second page and prefill the form elements with
>that
>> >>data. Then I want to submit that form.
>> >>
>> >>The problems:
>> >>1) this all needs to happen automatically
>> >>2) the second page is an external link and the source code therefore
>> cannot
>> >>be altered.
>> >>
>> >>Using JSP or a servlet whats the best way to prefill the form and post
>it?
>> >>Can it be done?
>> >>
>> >>If it cant be down using Java, can it be done with Javascript, PERL,
>cgi -
>> >>anything?
>> >>
>>
>>>=========================================================================
=
>> =
>> >>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
>> >JSP-INTEREST".
>> >>Some relevant FAQs on JSP/Servlets can be found at:
>> >>
>> >> http://java.sun.com/products/jsp/faq.html
>> >> http://www.esperanto.org.nz/jsp/jspfaq.html
>> >> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>> >> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>> >>
>> >
>>
>>==========================================================================
=
>> >To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
>> JSP-INTEREST".
>> >Some relevant FAQs on JSP/Servlets can be found at:
>> >
>> > http://java.sun.com/products/jsp/faq.html
>> > http://www.esperanto.org.nz/jsp/jspfaq.html
>> > http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>> > http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>> >
>>
>>
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
>Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets