You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by de...@yahoo.com on 2005/06/28 20:51:47 UTC

Organizing templates (newbie)

Hi,

I would like to know how I can organize my templates
in folders, eg. have my html as
$CONTEXT_ROOT/basic/Abc.html instead of
$CONTEXT_ROOT/Abc.html

When I try to simply put the htmls in a folder inside
the context root, I (very obviously) get an error:

"Could not find template for page Abc in locale en_US"

(All the examples I have seen so far keep the html
templates in the context root, also there seemed to be
no mention of this in the user-guide)

I imagine there should be some way to configure this
in the page specification file?

Thanks and Regards,
~ amol

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


Re: Organizing templates (newbie)

Posted by de...@yahoo.com.
Thanks!
That was exactly what I was looking for :)

(although I looked up the javadocs after reading your
mail and couldnt locate the rules in the javadocs)

Anyway, in case someone stumbles across this thread
here is the exact solution -

In Abc.page (page specification file) added the
following:

<context-asset name="$template"
path="/thepath/Abc.html"/>

Thanks and Regards,
~ amol



--- Jamie Orchard-Hays <ja...@dang.com> wrote:

> Sorry, you wanted to relocated the html template,
> not the page spec, right?
> 
> Here are the rules from DefaultTemplateSource:
> /**
>   *  Finds the template for the given component,
> using the following rules:
>   *  <ul>
>   *  <li>If the component has a $template asset, use
> that
>   *  <li>Look for a template in the same folder as
> the component
>   *  <li>If a page in the application namespace,
> search in the 
> application root
>   *  <li>Fail!
>   *  </ul>
>   *
>   *  @return the template, or null if not found
>   *
>   **/
> 
> You can also specify your own
> ITemplateSourceDelegate.
> 
> Hope this helps.
> 
> Jamie
> 
> 
> Jamie Orchard-Hays wrote:
> > in your .application file:
> > 
> > <page name="ThePageName" 
> >
>
specification-path="/WEB-INF/thepath/ThePageName.page"/>
> > 
> > deshmol-lists@yahoo.com wrote:
> > 
> >> Hi,
> >>
> >> I would like to know how I can organize my
> templates
> >> in folders, eg. have my html as
> >> $CONTEXT_ROOT/basic/Abc.html instead of
> >> $CONTEXT_ROOT/Abc.html
> >>
> >> When I try to simply put the htmls in a folder
> inside
> >> the context root, I (very obviously) get an
> error:
> >>
> >> "Could not find template for page Abc in locale
> en_US"
> >>
> >> (All the examples I have seen so far keep the
> html
> >> templates in the context root, also there seemed
> to be
> >> no mention of this in the user-guide)
> >>
> >> I imagine there should be some way to configure
> this
> >> in the page specification file?
> >>
> >> Thanks and Regards,
> >> ~ amol
> >>
> >>
>
---------------------------------------------------------------------
> >> To unsubscribe, e-mail:
> tapestry-user-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail:
> tapestry-user-help@jakarta.apache.org
> >>
> >>
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> tapestry-user-help@jakarta.apache.org
> > 
> > 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tapestry-user-help@jakarta.apache.org
> 
> 


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


Re: Organizing templates (newbie)

Posted by Jamie Orchard-Hays <ja...@dang.com>.
Sorry, you wanted to relocated the html template, not the page spec, right?

Here are the rules from DefaultTemplateSource:
/**
  *  Finds the template for the given component, using the following rules:
  *  <ul>
  *  <li>If the component has a $template asset, use that
  *  <li>Look for a template in the same folder as the component
  *  <li>If a page in the application namespace, search in the 
application root
  *  <li>Fail!
  *  </ul>
  *
  *  @return the template, or null if not found
  *
  **/

You can also specify your own ITemplateSourceDelegate.

Hope this helps.

Jamie


Jamie Orchard-Hays wrote:
> in your .application file:
> 
> <page name="ThePageName" 
> specification-path="/WEB-INF/thepath/ThePageName.page"/>
> 
> deshmol-lists@yahoo.com wrote:
> 
>> Hi,
>>
>> I would like to know how I can organize my templates
>> in folders, eg. have my html as
>> $CONTEXT_ROOT/basic/Abc.html instead of
>> $CONTEXT_ROOT/Abc.html
>>
>> When I try to simply put the htmls in a folder inside
>> the context root, I (very obviously) get an error:
>>
>> "Could not find template for page Abc in locale en_US"
>>
>> (All the examples I have seen so far keep the html
>> templates in the context root, also there seemed to be
>> no mention of this in the user-guide)
>>
>> I imagine there should be some way to configure this
>> in the page specification file?
>>
>> Thanks and Regards,
>> ~ amol
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 

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


Re: Organizing templates (newbie)

Posted by de...@yahoo.com.
I did the change as suggested, which also meant I had
to move the .page files under WEB-INF/thepath/, but it
still does not work.

To explain further, here is how I would like to
organize my deployment:


WebApp-Context-root/
  WEB-INF/
    Abc.page
    web.xml
    myapp.application
  html/
    Abc.html  <-- template file in a folder


 
As per the suggestion, I tried:


Context-root/
  WEB-INF/
    web.xml
    myapp.application
    html/      <--------------------------|
      Abc.page <-- moved .page file to matching folder
  html/
    Abc.html

...with the corresponding change in myapp.application.


Is there some way to map the actual location of the
html template to the .page specification file?

Thanks and Regards,
~ amol






--- Jamie Orchard-Hays <ja...@dang.com> wrote:

> in your .application file:
> 
> <page name="ThePageName" 
>
specification-path="/WEB-INF/thepath/ThePageName.page"/>
> 
> deshmol-lists@yahoo.com wrote:
> > Hi,
> > 
> > I would like to know how I can organize my
> templates
> > in folders, eg. have my html as
> > $CONTEXT_ROOT/basic/Abc.html instead of
> > $CONTEXT_ROOT/Abc.html
> > 
> > When I try to simply put the htmls in a folder
> inside
> > the context root, I (very obviously) get an error:
> > 
> > "Could not find template for page Abc in locale
> en_US"
> > 
> > (All the examples I have seen so far keep the html
> > templates in the context root, also there seemed
> to be
> > no mention of this in the user-guide)
> > 
> > I imagine there should be some way to configure
> this
> > in the page specification file?
> > 
> > Thanks and Regards,
> > ~ amol
> > 
> >

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


Re: Organizing templates (newbie)

Posted by Jamie Orchard-Hays <ja...@dang.com>.
in your .application file:

<page name="ThePageName" 
specification-path="/WEB-INF/thepath/ThePageName.page"/>

deshmol-lists@yahoo.com wrote:
> Hi,
> 
> I would like to know how I can organize my templates
> in folders, eg. have my html as
> $CONTEXT_ROOT/basic/Abc.html instead of
> $CONTEXT_ROOT/Abc.html
> 
> When I try to simply put the htmls in a folder inside
> the context root, I (very obviously) get an error:
> 
> "Could not find template for page Abc in locale en_US"
> 
> (All the examples I have seen so far keep the html
> templates in the context root, also there seemed to be
> no mention of this in the user-guide)
> 
> I imagine there should be some way to configure this
> in the page specification file?
> 
> Thanks and Regards,
> ~ amol
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 

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