Re: WOHTTPConnection & WORequest
Re: WOHTTPConnection & WORequest
- Subject: Re: WOHTTPConnection & WORequest
- From: David Griffith <email@hidden>
- Date: Thu, 27 Jul 2006 16:40:13 +0200
Hi Jerry,
Thanks for the detailed response. Actually I am already aware of all
of this and no I don't find the answer patronising as it is great to
see someone answer any question in such detail!
However, what I am trying to do is this:
On a WOComponent that already exists and contains a domain name in
one of the form fields, I want to have a button that when clicked
will take the domain name from the existing field (or variable) on
the WOComponent, construct a page that can be submitted transparently
to another server (not the WO server) and receive a response from
that server which I can then parse and display the relevant pieces of
information on the original WOComponent.
Kind regards,
David.
On 27 Jul 2006, at 16:00, Jerry W. Walker wrote:
Hi, David,
Are you asking how to submit a form to a WOApplication from one of
its WOComponents? Or are you asking for something much more involved?
If your question is the former, then do the following:
* Create a WOForm in your WOComponent.
* Embed all the WOForm elements that take form values
(WOTextField, WOTextArea, WOCheckBox, etc.) within that form along
with at least one WOSubmitButton or WOImageButton. This is most
easily done using WebObjects Builder.
* If you are using multiple submit and/or image buttons, be sure
to set the multipleSubmit binding on your WOForm to true.
* Bind each of your WOForm elements to keys (iVar or method
names) in your WOComponent's Java file.
* Bind each of your submit and/or image buttons to an action
method in your Java file (a method that takes no arguments and
returns a WOComponent value representing the page you want
displayed when that button is clicked).
* Vend the page (WOComponent containing your WOForm).
When the user fills out your form fields and clicks on the submit
button, the browser sends the page with an HTML POST request. The
WOAdaptor turns the HTML request into a WORequest and sends it to
your application in the first two of the following three messages
of the Request/Response cycle:
* takeValuesFromRequest - which WO uses to extract the values
from any of the form elements (contained in the form that also
contains the button that was clicked) and automatically inserts
them into the bound elements of your code.
* invokeAction - which WO uses to identify the submit button
element that was clicked and messages the action method which
you've bound to that submit button.
* appendToResponse - which WO uses to build a WOResponse that the
WOAdaptor translates into HTML and sends out through the web server
to render the next page.
The next page is determined by which page your action method
returns. You can put anything you want on that next page, including
only the values of the form elements of the previous page
containing the WOForm.
All of this automatic behavior is built into WO and you don't have
to do anything explicit like creating a WOHTTPConnection or a
WORequest. These are done for you. If this answers your question,
then I strongly urge you to go through the WO tutorials and
introductory material, otherwise you will end up misusing WO and
hating it.
If you are asking for something much more sophisticated than that
(like sending the page to a different server dynamically chosen at
the time the button is clicked, or something), then you will have
to be much more explicit about what you're trying to do when you
ask the question.
I hope that you didn't find the above information patronizing, but
if yours was a simple question, then that should answer it without
another round of "What are you really trying to do?" If it wasn't a
simple question, hit us again.
Regards,
Jerry
On Jul 27, 2006, at 9:29 AM, David Griffith wrote:
Hi Paul,
Because ultimately I will be submitting values that are already
part of the WO app and will be parsing the response to get the
various values I need. I do not want the user to see the actual
response page, only the pieces that I will extract from the response.
Kind regards,
David.
On 27 Jul 2006, at 14:50, Paul Suh wrote:
On Jul 27, 2006, at 7:36 AM, David Griffith wrote:
Hi all,
I want to allow a user to enter details into a HTML Form (in a
WOComponent) and when they click the Submit button, I would like
to open a connection to a standard HTTP server with a specific
URL and pass it the form values that the user entered. Can
someone tell me an easy way to do this? I can create the
WOHTTPConnection but I think I need a WORequest to send to it
and I can't figure out how to get the form values into that
request. It's probably easy I'm sure :-)
David,
Stupid question, but is there a particular reason why you need to
send it through your WO app? Why not point your form's URL
straight to the other HTTP server?
--Paul
Paul Suh
http://www.ps-enable.com/
email@hidden (240) 672-4212
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40gmail.com
This email sent to email@hidden
--
__ Jerry W. Walker,
WebObjects Developer/Instructor for High Performance Industrial
Strength Internet Enabled Systems
email@hidden
203 278-4085 office
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden