You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Tom Keeney <to...@novuscg.com> on 2001/11/28 17:20:31 UTC

Routing Between screens and actions in Turbine

Hello All,

I've coded a content management system in Jetspeed1.3a/Turbine2x to
manage all content submitted to our company portal. The application uses
the Turbine File Upload and Database Services extensively, and required
several screens with actions between screens for business logic.  Since
I had to figure out how to navigate between screens and action classes
to write the application, I thought I'd share some info with the group!

1) Simple routing between screens.
If you want to go directly from screen TestA.vm to screen TestB.vm, then
code the following action into TestA.vm:
action="$link.setPage('newdir,TestB.vm')"

For a general case, I'm assuming that TestB.vm is located in the
directory /templates/screens/newdir.  Note that if you're routing
between directories, the directory MUST be separated from the screen by
a comma.  Also, you need to include the *.vm extension.

2) Routing between screens with an action in the middle.
If you want to go from screen TestA.vm, through ActionA.class, then to
screen TestB.vm, code the following action into TestA.vm:
action="$link.setPage('newdir,TestB.vm').setAction('appdir.ActionA').add
PathInfo('publish','fromForm')"

If I've set my module package in TR.props to the following:
module.packages=com.mycompany.modules
Then ActionA has the following classpath:
com.mycompany.modules.actions.appdir.ActionA

Note that the period is necessary between "appdir" and "ActionA" in
setAction().

addPathInfo() will send the request parameter publish=fromForm to
ActionA.class.  This is request parameter is optional, of course.

3) Another way to route between screens with an action in the middle.
There is another way to route from screen TestA.vm, through
ActionA.class, then to screen TestB.vm.
First, code the following action in TestA.vm to get to ActionA.class:
action="$link.setPage('newdir,TestB.vm').setAction('appdir.ActionA')

Then, put the following statement at the end of ActionA.doPerform():
data.setScreenTemplate(newdir/TestB);

Note that the forward slash is necessary in this case.


In all three methods above, I've assumed that each Velocity screen has
an associated screen class with the same name.  Thus, before routing to
any Velocity screen, I'm executing the screen class first.  I only use
the screen classes to pass info into the context object for rendering on
the Velocity screen.


By the way, Turbine is way cool, especially the DB Service!

Tom Keeney
Novus Consulting Group
 

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>