Hi All,
As you may know or not, T5 doesn't have a web flow framework like the Spring
one yet. Howard mentioned he may add it in the next release. However, our
project cannot wait for that, therefore I have created a simple one on T5.
Here is the general idea, your comments are **GREATLY APPRECIATED**.
* A WEBFLOW, which is a normal T5 page, injects and contains PAGEs that
will used in this web flow.
* A PAGE can be used in multiple web flows. A PAGE doesn't have any
knowledge of where to go for next page, previous page or cancel link. All
these knowledge are dynamically populated from a WEBFLOW.
* A WEBFLOW has some data objects, which are annotated as @ApplicationState.
PAGEs can pick up whatever data they are interested, display them or
populate them.
* A typical request flow is like below:
=> An action request is post back to a PAGE
=> A PAGE will do some validation and populate the data
=> In onSuccess() method in PAGE, it returns the next page link, which is
populated by WEBFLOW and pointing to an action in WEBFLOW
=> A redirection action request is sent to WEBFLOW
=> Some onPage() method in WEBFLOW is triggered. It could review the data ,
decide the next page and return it.
=> A page render request is sent to the next page
Here are some code snippets :
============
public class WebFlow
{
@InjectPage
private WebFlowPage1 page1;
@InjectPage
private WebFlowPage2 page2;
@InjectPage
private WebFlowPage3 page3;
@SuppressWarnings("unused")
@ApplicationState
private SomeObject data;
...
private Object onStartPage()
{
page1.setNextPage( componentResources.createActionLink(
"page1", false )
);
page1.setCancelLink( componentResources.createActionLink(
"cancel", false
) );
return page1;
}
@SuppressWarnings("unused")
private Object onPage1()
{
page2.setNextPage( componentResources.createActionLink(
"page2", false )
);
page2.setPreviousPage( componentResources.createActionLink(
"startPage",
false ) );
page2.setCancelLink( componentResources.createActionLink(
"cancel", false
) );
return this.page2;
}
@SuppressWarnings("unused")
private Object onCancel()
{
this.clean();
return this;
}
....
}
public class WebFlowPage1 {
@Persist
private Link nextPage;
@Persist
private Link previousPage;
@Persist
private Link cancelLink;
@ApplicationState
private SomeObject data;
@SuppressWarnings("unused")
private Link onSuccess()
{
....
return nextPage;
}
@SuppressWarnings("unused")
private Object onActionFromPreviousPage()
{
...
return previousPage;
}
@SuppressWarnings("unused")
private Object onActionFromCancel()
{
return cancelLink;
}
...
}
--------------------
Cheers,
Jeffrey Ai
--
View this message in context:
http://www.nabble.com/T5%3A-A-web-flow-idea-on-T5-tp14442158p14442158.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]