You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Panu Hällfors <pa...@hallfors.com> on 2002/07/17 15:32:13 UTC

Resolving DefaultPage has problems

Hi!

I've just spent a few hours looking into dynamically
setting the (velocity) screen in a turbine action.

In the process (by Using the Source, thanks for marvellous
source code documentation, people!) I found out a little
problem with selecting the Page implementation to use to run
the execution of the action and template:
The Page implementation (VelocityPage, DefaultPage, etc.)
is chosen before running actions and the selection is
based on the file extension of the requested template.
If no template is selected, the system reads "default.extension"
setting from configuration. (it took a while for me to
figure this out :-)

Now, suppose the request does not contain any request for
a template - just an action. In the action, we do a
data.setScreenTemplate("whatever.vm"). If default.extension is not
set in configuration, Turbine will have selected DefaultPage
as template runner and fails to produce the screen.
Further on, suppose that we do a data.setScreenTemplate("whatever.jsp").
This time the system will fail whatever you do because
turbine has selected velocity tools for page handling
based on the default extension (which just doesn't apply just now).


I don't see the latter problem as a very critical one - we
come along with default.extension - but there may be someone
out there trying to use several templating systems in parallel.

Is there a solution for this (in Turbine 3 maybe)?

As I suppose there's no solution at least for Turbine 2,
I'd suggest adding
services.TemplateService.default.extension=vm
(with aproppriate documentation relating this issue)
in the default configuration files provided with the
sample applications in TDK.
This would hopefully save other people from the code-tracing
work I had to do to figure this out. :-)

   Panu

-- 
Panu Hällfors, panu@hallfors.com|CS Student, Helsinki University of Technology
   http://panu.hallfors.com     |   Internet Application Developer, Viloke Oy

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