Page Navigation: How to?

520 views
Skip to first unread message

luxspes

unread,
Feb 25, 2009, 11:35:15 PM2/25/09
to AribaWeb (aribaweb.org)
Hi!

How do I do a redirect from one page to another? How do I pass an
object from one page to another? Do I have to use the query string? or
do you support something like Rails flash or Seam conversations to do
that kind of work?

I navigation (and object exchange between page) programmatic, object
oriented and type safe as in Wicket or WebObjects? or is it XML based
(declarative, procedural oriented and type unsafe) as in JSF?

What do you think about <a href="http://luxspes.blogspot.com/2008/08/
navigation-no-hard-dependencies-no-type.html">this</a>.

Regards,

LuxSpes

Craig Federighi

unread,
Feb 25, 2009, 11:53:22 PM2/25/09
to arib...@googlegroups.com
Hi Luxspes,

> How do I do a redirect from one page to another? How do I pass an
> object from one page to another? Do I have to use the query string?

Oh lord, no! :-)

> I navigation (and object exchange between page) programmatic, object
> oriented and type safe as in Wicket or WebObjects


Yes.

e.g.:
class ComponentA ... {
public AWComponent doSomethingAction () {
ComponentB dest = pageWithName(ComponentB.class.getName());
dest.setSomething(something);
return dest;
}
...

And if, instead, you'd like B so show up in a nested panel (assuming
that B wrapped its content in a ModalPageWrapper):
public AWComponent doSomethingAction () {
ComponentB dest = pageWithName(ComponentB.class.getName());
dest.setSomething(something);
dest.setClientPanel(true);
return dest;
}

You can also, of course, initialize B with yourself (i.e. an instance
of A) or some other form of callback, so that B can call you back.
Or (for instance if B uses ModalPageWrapper) they may just
automatically return to the previous page.

> What do you think about <a href="http://luxspes.blogspot.com/2008/08/
> navigation-no-hard-dependencies-no-type.html">this</a>.


I think that whoever thought of this was really onto something! ;-)

- craig

luxspes

unread,
Feb 25, 2009, 11:56:28 PM2/25/09
to AribaWeb (aribaweb.org)
Oh, and just to complement the previous questions....

What if I do need to read some information from the query string?

Regards,


On Feb 25, 10:53 pm, Craig Federighi <craig.federi...@gmail.com>
wrote:

luxspes

unread,
Feb 25, 2009, 11:55:07 PM2/25/09
to AribaWeb (aribaweb.org)
Oh God, where where you all this years!!!!!!!!

On Feb 25, 10:53 pm, Craig Federighi <craig.federi...@gmail.com>
wrote:

Craig Federighi

unread,
Feb 26, 2009, 12:23:43 AM2/26/09
to arib...@googlegroups.com

What if I do need to read some information from the query string?

          someParam = requestContext().request().formValueForKey("someKey")

You can see both methods in action in the Documentation Search app page (see examples/Demo/search/SearchSource.groovy init() and show()):
  1) If the page is executed via a direct action (see example/Demo/app/DirectAction.java:docAction) it will look for an initial query string on a form param

  2) Or the page can be explicitly initialized.  See how the link from Demo/app/HomeContent.awl explicitly initializes the page via its custom show() method):
        ... Check out
      <a:Hyperlink action='${def p = pageWithName("SearchSource"); p.show("Creating_New_App.htm"); p}'>Creating_New_App</a:Hyperlink>

Note, that expression may obscure things a bit.  The hyperlink could be rewritten as:
 <a:Hyperlink action='$gotoDoc'>Creating_New_App</a:Hyperlink>

With the java/groovy file saying:
public AWComponent gotoDoc () {
SearchSource dest = (SearchSource)pageWithName(SearchSource.class.getName());
dest.show("Creating_New_App.html");
return dest;
}

(I ought to mention that this example is more confusing because this "show()" method is taking the name of a document to search for -- show("Creating_New_App.html") is telling this documentation search app to search for a particular piece of Documentation and display it  -- it's not some AW directive).

The nice thing about this kind of true OO model for page transitions is that you can always code a meta-layer on top if you want to structure specific kinds of flows.  AW does this in various ways: e.g. 1) the Wizard framework moves between a predefined set of "Step" pages (that don't need to know specifically about one another), 2) metaui's module navigation switches between pages as app-level tabs, etc.

Anyway, search the examples for uses of "pageWithName()" (you can use the Documentation tab of the demo app to do it!) -- you'll find a number of patterns at work.

- craig
Reply all
Reply to author
Forward
0 new messages