Re: WOForm Question
Re: WOForm Question
- Subject: Re: WOForm Question
- From: "Jerry W. Walker" <email@hidden>
- Date: Thu, 5 Apr 2007 07:59:45 -0400
Hi, David,
On Apr 5, 2007, at 7:07 AM, David Avendasora wrote:
Okay, I spoke a little too soon.
Besides all the code I had written to update the values manually, I
also had calls to other methods that updated things dependent upon
the values set in the form.
Now that I'm letting WO do all the work, it apparently waits to do
it until "return context().page();" (or "return null;" for Mike :)
is called to update the EOs.
No, actually it updates the EOs during the takeValuesFromRequest phase.
(Yes I need to read up on the request-response cycle.)
Your primary entry points are:
awake - when the request comes in (but applies to the page creating
your new page with pageWithName() ).
Component creation - during which your component is instantiated and
can initialize some of its own values. When your new component's
factory method returns to the previous page, that page will often
send values to your new page before its action method completes.
appendToResponse() - when WO sends the appendToResponse to your new
page to create and walk the object graph of its page template asking
each subcomponent and element to append its piece of HTML to the
response.
sleep() - when this cycle of the request response loop is finished.
awake() - when the new request comes in based on the context of the
page you put out in the appendToResponse (the last appendToResponse()
when the user hasn't hit the back button).
takeValuesFromRequest() - when WO recreates and walks the object
graph of the page template offering the values from the request form
to each of the components and dynamic elements in turn. The form
based dynamic elements will each look through the form values to
determine whether a value came from the piece of the form that they
generated and, if so, they will extract that value and do something
with it, typically meaning they will assign it to whatever is bound
to their value attribute.
invokeAction() - when WO again recreates and walks the object graph
of the page template, in effect asking each subcomponent and element
whether the piece of HTML that it had generated in the last
appendToResponse was the one which triggered this request and, if so,
what it wants to do about it (e.g. invoke the bound action method).
appendToResponse() - when WO again recreates and walks the object
graph of the page template (if you've returned context().page() or
null from the invoked action method) asking each subcomponent and
element to append its piece of HTML to the new response. Of course,
if your action method invokes pageWithName(), then WO instantiates an
object for the new page which starts at the top of the loop as
described here.
sleep() - when this cycle of the request response loop is finished.
Although the request-response loop is typically considered to have
started on the awake() method, from a WO perspective it is usually
better to consider it starting with the factory method of the
component and the subsequent appendToResponse. That's what creates
the page and its context on which the takeValuesFromRequest and the
invokeAction act.
Is there a way to manually trigger the update so I can then call
other methods that depend upon the updated data before the return
statement?
Let WO trigger the update (or, more accurately, let the request do
so) and you merely override takeValuesFromRequest() when it does so.
Hope this helps.
Regards,
Jerry
Dave
On Apr 4, 2007, at 4:20 PM, Chuck Hill wrote:
and it works like a charm. Amazing. You know, WO is kinda nice. :D
That is why we keep using it! :-P
--
__ 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