You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by ri...@2en40.nl on 2006/10/24 17:42:33 UTC

defining paths for templates

The people in the project I'm in prefer to keep the java-sources and
tapestry files that belong together in one and the same directory
(Home.java together with Home.page en Home.html, for example). This
basically means that all Tapestry-files will be placed outside of
WEB-INF.

Now I finally succeded to get Tapestry to find the jwc and page files.
Alas, tapestry won't load the related templates. I even tried the
trick of using an asset, like this:

<asset name="$template" path="Home.html"/>

But this doesn't work either, as Tapestry complains about not being
able to find the html file on the class path. It also seems
superfluous to me, since tapestry is supposed to find the templates in
the same directory as the page or component files.

If anyone has any pointers, I'll be grateful.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: {SPAM?} RE: defining paths for templates

Posted by andyhot <an...@di.uoa.gr>.
richard@2en40.nl wrote:
> I did create a library, in which I refer to the pages and jwc files
> explicitly. This seems to aid finding the pages and components, but
> not the templates.

That's weird... even the framework does this:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/Framework.library?view=markup
The exception page is defined in the library and found on the classpath.

Perhaps something else messes up things?

Do you have a custom specification or template resolver?

> Somehow the search-rule of finding the templates along with the
> components and pages in the same directory does not work.
>
>> I started out with all in the WEB-INF directory.  If you want to put
>>  the .html/.jwc files in the same directory as the .page you can, 
>> Tapestry will find it automatically.  Then the .java file can be 
>> anywhere, you just specify it's location in the .jwc.  That is the 
>> simplest model.  A bit more complicated is to create sub-directories
>>  under the WEB-INF, then you have to tell Tapestry, via the 
>> .application file where to find the components.
>>
>> A more complicated, but more in line with the Tapestry Model is to 
>> create libraries, like "contrib".  I started out with the simple 
>> model and then needed to create libraries.  Eventually, I wanted to 
>> create libraries, in order to do that I had to move everything around.
>>
>> Creating libraries is pretty simple.  In the directory/package for 
>> the .java, I put the .html and the .jwc.  I put a .library file and 
>> jar it all together.  Then I include the .library in the 
>> .application.  Then whenever, I want to reference one of my 
>> components, I just prefix it like you would "contrib".
>>
>> HTH,
>>
>> Mark
>>
>> Mark J. Stang
>> Senior Engineer/Architect
>> office: +1 303.468.2900
>> mobile: +1 303.507.2833
>> Ping Identity
>>
>>
>>
>> -----Original Message-----
>> From: richard@2en40.nl [mailto:richard@2en40.nl]
>> Sent: Tue 10/24/2006 9:42 AM
>> To: users@tapestry.apache.org
>> Subject: defining paths for templates
>>
>> The people in the project I'm in prefer to keep the java-sources and
>> tapestry files that belong together in one and the same directory
>> (Home.java together with Home.page en Home.html, for example). This
>> basically means that all Tapestry-files will be placed outside of
>> WEB-INF.
>>
>> Now I finally succeded to get Tapestry to find the jwc and page files.
>> Alas, tapestry won't load the related templates. I even tried the
>> trick of using an asset, like this:
>>
>> <asset name="$template" path="Home.html"/>
>>
>> But this doesn't work either, as Tapestry complains about not being
>> able to find the html file on the class path. It also seems
>> superfluous to me, since tapestry is supposed to find the templates in
>> the same directory as the page or component files.
>>
>> If anyone has any pointers, I'll be grateful.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>


-- 
Andreas Andreou - andyhot@apache.org - http://andyhot.di.uoa.gr
Tapestry / Tacos developer
Open Source / J2EE Consulting 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


RE: defining paths for templates

Posted by Mark Stang <ms...@pingidentity.com>.
I am sure that is one option.  My goal was creating Tapestry Libraries where the components are all packaged together in a single jar.  Currently, I have about five different libraries.  A couple are used to "swap out" branding.  Where in my case the same component exists for different brands, but have a different look and feel.

regards,

Mark

Mark J. Stang
Senior Engineer/Architect
office: +1 303.468.2900
mobile: +1 303.507.2833
Ping Identity



-----Original Message-----
From: Patrick Moore [mailto:transparentpolitics@gmail.com]
Sent: Tue 10/24/2006 2:29 PM
To: Tapestry users
Subject: Re: defining paths for templates
 
I too liked having the html files together with the java sources, but
I think your assumption that that means the html files have to be in
the same directory as the class files should be revisited.

I found it pretty easy under maven2 to extract out the html,
properties, and script files from my source packages
"com.transparentpolitics.web.pages" and
"com.transparentpolitics.web.components" directory and drop them in
the webapp and WEB-INF directory under my target output directory.

This is the relevant part of my maven2 pom.xml (note that you need the
2.0.2 version for this to work):

            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.0.2-SNAPSHOT</version>
                <configuration>
                    <!--

<warSourceDirectory>${basedir}/src/context</warSourceDirectory>
                    -->
                    <webResources>
                        <resource>
                            <!-- this is relative to the pom.xml directory -->
                            <directory>

src/main/java/com/transparentpolitics/web/components
                            </directory>
                            <targetPath>WEB-INF</targetPath>
                            <includes>
                                <include>**/*.html</include>
                                <include>**/*.jwc</include>
                                <include>**/*.properties</include>
                            </includes>
                            <excludes>
                                <exclude>**/package.html</exclude>
                            </excludes>
                        </resource>
                        <resource>
                            <!-- this is relative to the pom.xml directory -->
                            <directory>

src/main/java/org/apache/tapestry/contrib/dojo/html
                            </directory>
                            <targetPath>WEB-INF</targetPath>
                            <includes>
                                <include>**/*.html</include>
                                <include>**/*.jwc</include>
                                <include>**/*.script</include>
                                <include>**/*.properties</include>
                            </includes>
                            <excludes>
                                <exclude>**/package.html</exclude>
                            </excludes>
                        </resource>
                        <resource>
                            <!-- this is relative to the pom.xml directory -->
                            <directory>
                                src/main/java/com/transparentpolitics/web/pages
                            </directory>
                            <includes>
                                <include>**/*.html</include>
                                <include>**/*.page</include>
                            </includes>
                            <excludes>
                                <exclude>**/package.html</exclude>
                            </excludes>
                        </resource>
                        <resource>
                            <!-- page properties need to go under the
WEB-INF directory -->
                            <directory>
                                src/main/java/com/transparentpolitics/web/pages
                            </directory>
                            <targetPath>WEB-INF</targetPath>
                            <includes>
                                <include>**/*.properties</include>
                            </includes>
                        </resource>
                    </webResources>
                </configuration>
            </plugin>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org



Re: defining paths for templates

Posted by Patrick Moore <tr...@gmail.com>.
I too liked having the html files together with the java sources, but
I think your assumption that that means the html files have to be in
the same directory as the class files should be revisited.

I found it pretty easy under maven2 to extract out the html,
properties, and script files from my source packages
"com.transparentpolitics.web.pages" and
"com.transparentpolitics.web.components" directory and drop them in
the webapp and WEB-INF directory under my target output directory.

This is the relevant part of my maven2 pom.xml (note that you need the
2.0.2 version for this to work):

            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.0.2-SNAPSHOT</version>
                <configuration>
                    <!--

<warSourceDirectory>${basedir}/src/context</warSourceDirectory>
                    -->
                    <webResources>
                        <resource>
                            <!-- this is relative to the pom.xml directory -->
                            <directory>

src/main/java/com/transparentpolitics/web/components
                            </directory>
                            <targetPath>WEB-INF</targetPath>
                            <includes>
                                <include>**/*.html</include>
                                <include>**/*.jwc</include>
                                <include>**/*.properties</include>
                            </includes>
                            <excludes>
                                <exclude>**/package.html</exclude>
                            </excludes>
                        </resource>
                        <resource>
                            <!-- this is relative to the pom.xml directory -->
                            <directory>

src/main/java/org/apache/tapestry/contrib/dojo/html
                            </directory>
                            <targetPath>WEB-INF</targetPath>
                            <includes>
                                <include>**/*.html</include>
                                <include>**/*.jwc</include>
                                <include>**/*.script</include>
                                <include>**/*.properties</include>
                            </includes>
                            <excludes>
                                <exclude>**/package.html</exclude>
                            </excludes>
                        </resource>
                        <resource>
                            <!-- this is relative to the pom.xml directory -->
                            <directory>
                                src/main/java/com/transparentpolitics/web/pages
                            </directory>
                            <includes>
                                <include>**/*.html</include>
                                <include>**/*.page</include>
                            </includes>
                            <excludes>
                                <exclude>**/package.html</exclude>
                            </excludes>
                        </resource>
                        <resource>
                            <!-- page properties need to go under the
WEB-INF directory -->
                            <directory>
                                src/main/java/com/transparentpolitics/web/pages
                            </directory>
                            <targetPath>WEB-INF</targetPath>
                            <includes>
                                <include>**/*.properties</include>
                            </includes>
                        </resource>
                    </webResources>
                </configuration>
            </plugin>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


RE: defining paths for templates

Posted by Mark Stang <ms...@pingidentity.com>.
Yeah, I don't know how things have changed from 3.x to 4.02.  Maybe Jesse can help....


Mark J. Stang
Senior Engineer/Architect
office: +1 303.468.2900
mobile: +1 303.507.2833
Ping Identity



-----Original Message-----
From: richard@2en40.nl [mailto:richard@2en40.nl]
Sent: Tue 10/24/2006 11:40 AM
To: users@tapestry.apache.org
Subject: RE: defining paths for templates
 
Perhaps I should have mentioned that I am using Tapestry 4.0.2. I did  
all you mentioned, but I keep getting the error message that the  
template for locale en_US can't be found. I am pretty sure it's no  
locale problem though, since Tapestry should find the default-template  
anyway.

> Sample Library.
>
> PingCommon.library:
>
> <!DOCTYPE library-specification PUBLIC
>   "-//Apache Software Foundation//Tapestry Specification 3.0//EN"
>   "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
>
> <library-specification>
> 	<component-type type="AdapterContract"   
> specification-path="AdapterContract.jwc"/>
> </library-specification>
>
>
> In the java package (/com/pingidentity/component/common/), copy in   
> the .jwc, .html and .library.
> Jar this up and put it on the classpath.
>
> This goes into the .application file.
>     <library id="common"   
> specification-path="/com/pingidentity/component/common/PingCommon.library"/>
>
> Then you should be able to access it as "common:AdapterContract".
>
> Does that help, if not, then maybe you could post some of your code?
>
> regards,
>
> Mark
>
>
> Mark J. Stang
> Senior Engineer/Architect
> office: +1 303.468.2900
> mobile: +1 303.507.2833
> Ping Identity
>
>
>
> -----Original Message-----
> From: richard@2en40.nl [mailto:richard@2en40.nl]
> Sent: Tue 10/24/2006 10:07 AM
> To: users@tapestry.apache.org
> Subject: RE: defining paths for templates
>
> I did create a library, in which I refer to the pages and jwc files
> explicitly. This seems to aid finding the pages and components, but
> not the templates. Somehow the search-rule of finding the templates
> along with the components and pages in the same directory does not work.
>
>> I started out with all in the WEB-INF directory.  If you want to put
>>  the .html/.jwc files in the same directory as the .page you can,
>> Tapestry will find it automatically.  Then the .java file can be
>> anywhere, you just specify it's location in the .jwc.  That is the
>> simplest model.  A bit more complicated is to create sub-directories
>>  under the WEB-INF, then you have to tell Tapestry, via the
>> .application file where to find the components.
>>
>> A more complicated, but more in line with the Tapestry Model is to
>> create libraries, like "contrib".  I started out with the simple
>> model and then needed to create libraries.  Eventually, I wanted to
>> create libraries, in order to do that I had to move everything around.
>>
>> Creating libraries is pretty simple.  In the directory/package for
>> the .java, I put the .html and the .jwc.  I put a .library file and
>> jar it all together.  Then I include the .library in the
>> .application.  Then whenever, I want to reference one of my
>> components, I just prefix it like you would "contrib".
>>
>> HTH,
>>
>> Mark
>>
>> Mark J. Stang
>> Senior Engineer/Architect
>> office: +1 303.468.2900
>> mobile: +1 303.507.2833
>> Ping Identity
>>
>>
>>
>> -----Original Message-----
>> From: richard@2en40.nl [mailto:richard@2en40.nl]
>> Sent: Tue 10/24/2006 9:42 AM
>> To: users@tapestry.apache.org
>> Subject: defining paths for templates
>>
>> The people in the project I'm in prefer to keep the java-sources and
>> tapestry files that belong together in one and the same directory
>> (Home.java together with Home.page en Home.html, for example). This
>> basically means that all Tapestry-files will be placed outside of
>> WEB-INF.
>>
>> Now I finally succeded to get Tapestry to find the jwc and page files.
>> Alas, tapestry won't load the related templates. I even tried the
>> trick of using an asset, like this:
>>
>> <asset name="$template" path="Home.html"/>
>>
>> But this doesn't work either, as Tapestry complains about not being
>> able to find the html file on the class path. It also seems
>> superfluous to me, since tapestry is supposed to find the templates in
>> the same directory as the page or component files.
>>
>> If anyone has any pointers, I'll be grateful.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org



RE: defining paths for templates

Posted by ri...@2en40.nl.
Perhaps I should have mentioned that I am using Tapestry 4.0.2. I did  
all you mentioned, but I keep getting the error message that the  
template for locale en_US can't be found. I am pretty sure it's no  
locale problem though, since Tapestry should find the default-template  
anyway.

> Sample Library.
>
> PingCommon.library:
>
> <!DOCTYPE library-specification PUBLIC
>   "-//Apache Software Foundation//Tapestry Specification 3.0//EN"
>   "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
>
> <library-specification>
> 	<component-type type="AdapterContract"   
> specification-path="AdapterContract.jwc"/>
> </library-specification>
>
>
> In the java package (/com/pingidentity/component/common/), copy in   
> the .jwc, .html and .library.
> Jar this up and put it on the classpath.
>
> This goes into the .application file.
>     <library id="common"   
> specification-path="/com/pingidentity/component/common/PingCommon.library"/>
>
> Then you should be able to access it as "common:AdapterContract".
>
> Does that help, if not, then maybe you could post some of your code?
>
> regards,
>
> Mark
>
>
> Mark J. Stang
> Senior Engineer/Architect
> office: +1 303.468.2900
> mobile: +1 303.507.2833
> Ping Identity
>
>
>
> -----Original Message-----
> From: richard@2en40.nl [mailto:richard@2en40.nl]
> Sent: Tue 10/24/2006 10:07 AM
> To: users@tapestry.apache.org
> Subject: RE: defining paths for templates
>
> I did create a library, in which I refer to the pages and jwc files
> explicitly. This seems to aid finding the pages and components, but
> not the templates. Somehow the search-rule of finding the templates
> along with the components and pages in the same directory does not work.
>
>> I started out with all in the WEB-INF directory.  If you want to put
>>  the .html/.jwc files in the same directory as the .page you can,
>> Tapestry will find it automatically.  Then the .java file can be
>> anywhere, you just specify it's location in the .jwc.  That is the
>> simplest model.  A bit more complicated is to create sub-directories
>>  under the WEB-INF, then you have to tell Tapestry, via the
>> .application file where to find the components.
>>
>> A more complicated, but more in line with the Tapestry Model is to
>> create libraries, like "contrib".  I started out with the simple
>> model and then needed to create libraries.  Eventually, I wanted to
>> create libraries, in order to do that I had to move everything around.
>>
>> Creating libraries is pretty simple.  In the directory/package for
>> the .java, I put the .html and the .jwc.  I put a .library file and
>> jar it all together.  Then I include the .library in the
>> .application.  Then whenever, I want to reference one of my
>> components, I just prefix it like you would "contrib".
>>
>> HTH,
>>
>> Mark
>>
>> Mark J. Stang
>> Senior Engineer/Architect
>> office: +1 303.468.2900
>> mobile: +1 303.507.2833
>> Ping Identity
>>
>>
>>
>> -----Original Message-----
>> From: richard@2en40.nl [mailto:richard@2en40.nl]
>> Sent: Tue 10/24/2006 9:42 AM
>> To: users@tapestry.apache.org
>> Subject: defining paths for templates
>>
>> The people in the project I'm in prefer to keep the java-sources and
>> tapestry files that belong together in one and the same directory
>> (Home.java together with Home.page en Home.html, for example). This
>> basically means that all Tapestry-files will be placed outside of
>> WEB-INF.
>>
>> Now I finally succeded to get Tapestry to find the jwc and page files.
>> Alas, tapestry won't load the related templates. I even tried the
>> trick of using an asset, like this:
>>
>> <asset name="$template" path="Home.html"/>
>>
>> But this doesn't work either, as Tapestry complains about not being
>> able to find the html file on the class path. It also seems
>> superfluous to me, since tapestry is supposed to find the templates in
>> the same directory as the page or component files.
>>
>> If anyone has any pointers, I'll be grateful.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


RE: defining paths for templates

Posted by Mark Stang <ms...@pingidentity.com>.
Sample Library.

PingCommon.library:

<!DOCTYPE library-specification PUBLIC 
  "-//Apache Software Foundation//Tapestry Specification 3.0//EN" 
  "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
	
<library-specification>
	<component-type type="AdapterContract" specification-path="AdapterContract.jwc"/>
</library-specification>


In the java package (/com/pingidentity/component/common/), copy in the .jwc, .html and .library.
Jar this up and put it on the classpath.

This goes into the .application file.
    <library id="common" specification-path="/com/pingidentity/component/common/PingCommon.library"/>

Then you should be able to access it as "common:AdapterContract".

Does that help, if not, then maybe you could post some of your code?

regards,

Mark


Mark J. Stang
Senior Engineer/Architect
office: +1 303.468.2900
mobile: +1 303.507.2833
Ping Identity



-----Original Message-----
From: richard@2en40.nl [mailto:richard@2en40.nl]
Sent: Tue 10/24/2006 10:07 AM
To: users@tapestry.apache.org
Subject: RE: defining paths for templates
 
I did create a library, in which I refer to the pages and jwc files  
explicitly. This seems to aid finding the pages and components, but  
not the templates. Somehow the search-rule of finding the templates  
along with the components and pages in the same directory does not work.

> I started out with all in the WEB-INF directory.  If you want to put  
>  the .html/.jwc files in the same directory as the .page you can,   
> Tapestry will find it automatically.  Then the .java file can be   
> anywhere, you just specify it's location in the .jwc.  That is the   
> simplest model.  A bit more complicated is to create sub-directories  
>  under the WEB-INF, then you have to tell Tapestry, via the   
> .application file where to find the components.
>
> A more complicated, but more in line with the Tapestry Model is to   
> create libraries, like "contrib".  I started out with the simple   
> model and then needed to create libraries.  Eventually, I wanted to   
> create libraries, in order to do that I had to move everything around.
>
> Creating libraries is pretty simple.  In the directory/package for   
> the .java, I put the .html and the .jwc.  I put a .library file and   
> jar it all together.  Then I include the .library in the   
> .application.  Then whenever, I want to reference one of my   
> components, I just prefix it like you would "contrib".
>
> HTH,
>
> Mark
>
> Mark J. Stang
> Senior Engineer/Architect
> office: +1 303.468.2900
> mobile: +1 303.507.2833
> Ping Identity
>
>
>
> -----Original Message-----
> From: richard@2en40.nl [mailto:richard@2en40.nl]
> Sent: Tue 10/24/2006 9:42 AM
> To: users@tapestry.apache.org
> Subject: defining paths for templates
>
> The people in the project I'm in prefer to keep the java-sources and
> tapestry files that belong together in one and the same directory
> (Home.java together with Home.page en Home.html, for example). This
> basically means that all Tapestry-files will be placed outside of
> WEB-INF.
>
> Now I finally succeded to get Tapestry to find the jwc and page files.
> Alas, tapestry won't load the related templates. I even tried the
> trick of using an asset, like this:
>
> <asset name="$template" path="Home.html"/>
>
> But this doesn't work either, as Tapestry complains about not being
> able to find the html file on the class path. It also seems
> superfluous to me, since tapestry is supposed to find the templates in
> the same directory as the page or component files.
>
> If anyone has any pointers, I'll be grateful.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org



RE: defining paths for templates

Posted by ri...@2en40.nl.
I did create a library, in which I refer to the pages and jwc files  
explicitly. This seems to aid finding the pages and components, but  
not the templates. Somehow the search-rule of finding the templates  
along with the components and pages in the same directory does not work.

> I started out with all in the WEB-INF directory.  If you want to put  
>  the .html/.jwc files in the same directory as the .page you can,   
> Tapestry will find it automatically.  Then the .java file can be   
> anywhere, you just specify it's location in the .jwc.  That is the   
> simplest model.  A bit more complicated is to create sub-directories  
>  under the WEB-INF, then you have to tell Tapestry, via the   
> .application file where to find the components.
>
> A more complicated, but more in line with the Tapestry Model is to   
> create libraries, like "contrib".  I started out with the simple   
> model and then needed to create libraries.  Eventually, I wanted to   
> create libraries, in order to do that I had to move everything around.
>
> Creating libraries is pretty simple.  In the directory/package for   
> the .java, I put the .html and the .jwc.  I put a .library file and   
> jar it all together.  Then I include the .library in the   
> .application.  Then whenever, I want to reference one of my   
> components, I just prefix it like you would "contrib".
>
> HTH,
>
> Mark
>
> Mark J. Stang
> Senior Engineer/Architect
> office: +1 303.468.2900
> mobile: +1 303.507.2833
> Ping Identity
>
>
>
> -----Original Message-----
> From: richard@2en40.nl [mailto:richard@2en40.nl]
> Sent: Tue 10/24/2006 9:42 AM
> To: users@tapestry.apache.org
> Subject: defining paths for templates
>
> The people in the project I'm in prefer to keep the java-sources and
> tapestry files that belong together in one and the same directory
> (Home.java together with Home.page en Home.html, for example). This
> basically means that all Tapestry-files will be placed outside of
> WEB-INF.
>
> Now I finally succeded to get Tapestry to find the jwc and page files.
> Alas, tapestry won't load the related templates. I even tried the
> trick of using an asset, like this:
>
> <asset name="$template" path="Home.html"/>
>
> But this doesn't work either, as Tapestry complains about not being
> able to find the html file on the class path. It also seems
> superfluous to me, since tapestry is supposed to find the templates in
> the same directory as the page or component files.
>
> If anyone has any pointers, I'll be grateful.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


RE: defining paths for templates

Posted by Mark Stang <ms...@pingidentity.com>.
I started out with all in the WEB-INF directory.  If you want to put the .html/.jwc files in the same directory as the .page you can, Tapestry will find it automatically.  Then the .java file can be anywhere, you just specify it's location in the .jwc.  That is the simplest model.  A bit more complicated is to create sub-directories under the WEB-INF, then you have to tell Tapestry, via the .application file where to find the components.

A more complicated, but more in line with the Tapestry Model is to create libraries, like "contrib".  I started out with the simple model and then needed to create libraries.  Eventually, I wanted to create libraries, in order to do that I had to move everything around.  

Creating libraries is pretty simple.  In the directory/package for the .java, I put the .html and the .jwc.  I put a .library file and jar it all together.  Then I include the .library in the .application.  Then whenever, I want to reference one of my components, I just prefix it like you would "contrib".

HTH,

Mark

Mark J. Stang
Senior Engineer/Architect
office: +1 303.468.2900
mobile: +1 303.507.2833
Ping Identity



-----Original Message-----
From: richard@2en40.nl [mailto:richard@2en40.nl]
Sent: Tue 10/24/2006 9:42 AM
To: users@tapestry.apache.org
Subject: defining paths for templates
 
The people in the project I'm in prefer to keep the java-sources and
tapestry files that belong together in one and the same directory
(Home.java together with Home.page en Home.html, for example). This
basically means that all Tapestry-files will be placed outside of
WEB-INF.

Now I finally succeded to get Tapestry to find the jwc and page files.
Alas, tapestry won't load the related templates. I even tried the
trick of using an asset, like this:

<asset name="$template" path="Home.html"/>

But this doesn't work either, as Tapestry complains about not being
able to find the html file on the class path. It also seems
superfluous to me, since tapestry is supposed to find the templates in
the same directory as the page or component files.

If anyone has any pointers, I'll be grateful.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org