Sorry, I signed the message when I had additional comment below.
sv
On Mon, 29 Aug 2005, Stephane Vaucher wrote:
1/ Can you reply when people want to help you debug your app. And yes, we've
pretty much all are able to play with our layouts.
2/ Don't start a new thread (with a different subject). When you do start a
thread, choose a better subject "Really stuck now..." is normally filtered by
my spam filter as containing pornographic content. "How to
execute custom layout".
On Mon, 29 Aug 2005, Dan Nicolici wrote:
Hi!
I still have doubts on the topic of my previous post.
This is the one:
"I am trying to get my java module for the layout to be execyted, but
somehow it seems to skip it. All my java screens associated with .vm's are
executed as expected. Following the same organizational pattern with
layouts it doesn't work.
Project structure example:
com.company.modules.layouts
|
---LayoutOne.java
com.company.modules.screens
|
---ScreenOne.java
templates
|
---screens
| |
| ---ScreenOne.vm
|
---layouts
|
---LayoutOne.vm
I have added a properties file that specifies my modules packages. Ex:
module.packages = com.company.modules ,
and still it behaves like I said before. Can anyone please help me?"
Ok. Now the Turbine specification says the process of execution is as
follows (I copy/paste -ed it):
HTTP Client -> Execute Turbine Servlet -> Execute Page -> Execute
Layout/Screen/Navigation -> Return Page Content
If Action is defined then...
Execute Action
What does executing a layout refer to?
Using the specified templating engine (in your case probably velocity) to
generate the page returned. It will insert the screen content where you
specified it.
Only the layout's .vm file? Then why does it say that I can override (or
subclass...) turbine's modules (org.apache.turbine.modules) with my own
(com.company.modules)? My understanding was that writing my own modules
would lead to their executin in place (or at least prior) to those default
to turbine (org.apache.turbine.modules).
There is a concept of priority. I believe it looks in the ordre that you
configured your modules in the config file. If you execute the screen foo.vm
without programmatically specifying a layout. It will attempt to find a
layout foo.vm and Foo.java prefixed by your module.packages param
"com.company.modules" in your example above.
Might I add that the default module for the layout gets executed (I mean
the actual java class written for the default layout template ... I assume
- possibly wrong - that there is one) despite the fact that my custom
module exists and it is mentioned in the properties file. I am relatively
(2 -3 months) new to turbine framework and I may be wrong (the
documentation is a little poor - no offense).
I believe by default, it does nothing. You need to subclass a layout for it
to work. As for documentation, I guess you're relatively new to open-source
projects (and not the major one with large commercial financing like struts).
What I want to do is this:
- write a layout template (ex. MyLayout.vm)
- define it as a default layout module in the TurbineResources.properties
file
- write a class with the same name (MyLayout.java) in the specified layout
module (com.company.modules.layouts)
- set-up a screen to have this new layout
(data.setLayoutTemplate("MyLayout.vm"))
- ... and voilla. I navigate to that screen, Turbine loads the layout for
it (MyLayout.vm, executing the MyLayout.java too - here is the problem
really), executes the screen's java file and gives back the html.
Do I want the impossible? If so, please wake me up from my dream :) If not,
please tell me how it can be done.
Sure it can be done, and I would guide you for this, but I just completed a
turbine project and don't have access to the code anymore. Someone else can
probably help you out.
sv
Many many thanks!
Dan
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]