You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Dan Nicolici <da...@nexource.ro> on 2005/08/29 09:09:03 UTC

Really stuck now...

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? 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). 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).

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.

Many many thanks!

Dan

Re: Really stuck now...

Posted by Stephane Vaucher <va...@iro.umontreal.ca>.
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: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: Really stuck now...

Posted by Dan Nicolici <da...@nexource.ro>.
Stephane, I'm really sorry about not replying. I am using Outlook Express
for this mailing list (and I think that is not a very good ideea) and that's
probably why it does not post replies but new messages. I guess I am used to
post in news groups...
Thank you for replying. Yes. I am new to open-source projects (under one
year:) and specially to turbine. Somebody told me that no other modules
other than the screens module will have the .vn -> .java relationship. That
really means the behavior I was expecting is never going to happen like
that. Is this true? From what you told me, it seems that it must work as I
expected it.

Regards,

Dan


----- Original Message -----
From: "Stephane Vaucher" <va...@iro.umontreal.ca>
To: "Turbine Users List" <tu...@jakarta.apache.org>
Sent: Monday, August 29, 2005 5:42 PM
Subject: Re: Really stuck now...


> 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".
>
> sv
>
> 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: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
>
>
>
> __________ NOD32 1.1204 (20050829) Information __________
>
> This message was checked by NOD32 antivirus system.
> http://www.eset.com
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: Really stuck now...

Posted by Stephane Vaucher <va...@iro.umontreal.ca>.
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".

sv

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: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org