On Wed, 2002-05-15 at 14:36, Mark Nutter wrote:
> On Wed, 2002-05-15 at 11:14, Godwin Ko wrote:
> > If I create a screen class named Default.java at the top screen level then
> > all template files that with no screen class defined will use this default
> > screen class, is this the default behavior of turbine 2.1? I'm a little bit
> > confuse about the java screen binding with template. The template search
> > sequence has been documented in Velocity Site howto but is the screen class
> > search sequence the same as template?
Did some more digging :) According to the Javadoc for
org.apache.turbine.modules.pages.DefaultPage, the answer is Yes, the
search for a screen class the same way it searches for a Velocity
template. Turbine looks for a screen class with the same name as the
screen template (except that the first letter of the class name is
forced to uppercase, and with .class instead of .vm), in the directory
parallel to the directory/path of the screen, i.e. if the screen is in
.../templates/com/mysite/myapp/modules/screens/pub/MyScreen.vm
then the corresponding screen class would be in
.../classes/com/mysite/myapp/modules/screens/pub/MyScreen.class
Or it might be
.../classes/com/mysite/myapp/modules/screens/pub/Myscreen.class
lower case!--^
I'm not sure how the capitalization works. Anyway, if it doesn't find
the class where it expects to, it looks for a class named Default.class,
starting in the directory where the screen class should have been, and
working its way up. One wrinkle is that the search path includes all
paths listed in the "module.packages" line of TR.props, so if your
TR.props file has
module.packages=com/mysite/myapp/modules,org/apache/turbine/flux/modules
then the search will go like this:
.../classes/com/mysite/myapp/modules/screens/pub/Default.class
.../classes/com/mysite/myapp/modules/screens/Default.class
.../classes/org/apache/turbine/flux/modules/screens/pub/Default.class
.../classes/org/apache/turbine/flux/modules/screens/Default.class
I did some testing, writing some Default classes that put the
fully-qualified default class name into the Velocity context as
$MyScreen, and then modifying my templates to print out $MyScreen.
Under TDK/Turbine 2.1, it works as advertised on my system. I thought I
had a situation where the Default.class was overriding my Index.class
for Index.vm, but apparently that was a fluke. It must not have been
finding my Index.class file for some reason, not sure why, but it went
away on a rebuild/restart.
HTH.
Mark
[EMAIL PROTECTED]
My horoscope says today is a bad day to be superstitious.
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>