Template classpath

View: New views
2 Messages — Rating Filter:   Alert me  

Template classpath

by Artur Kraft :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi Rifers,

I'm digging through the docs and the examples, but am unable to set the
template path right. The code I'm refering to is:
Template template = getHtmlTemplate("../templates/helloworld");

Thats what I want to achive because my "templates" dir is on the same
dir level as the "classes" dir. Yet somehow I can't go up a level.
Templates are located through the classpath, which in my case are:
C:\sun\java\jdk1.6.0_03\lib\tools.jar;
C:\appData\apache-tomcat-6.0.14\bin\bootstrap.jar

Meanwhile the template dir is:
C:\appData\apache-tomcat-6.0.14\webapps\rife\WEB-INF\templates\helloworld.html
So, according to the bootstrap path the right path should be
"../webapps/rife/WEB-INF/templates/helloworld", but that raises the
error msg: Couldn't find template
'../webapps/rife/WEB-INF/templates/helloworld'.

Is there a way to use the templates dir on the same level as the classes
dir or do you have to put the templates and other rife resources all in
the classes dir?

cheers,
Artur


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "rife-users" group.
To post to this group, send email to rife-users@...
To unsubscribe from this group, send email to rife-users-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rife-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Template classpath

by Geert Bevin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi Artur,

templates are always looked up through the classpath. This can either  
be through the classes dir or in a jar. You can also setup the  
classpath yourself if you're running outside the container. One thing  
to realize is that you can use a standard and optional 'templates'  
prefix in the classpath.

So you could put them at:

webapps\rife\WEB-INF\classes\templates\helloworld.html

and look them up as:

Template template = getHtmlTemplate("helloworld");

Hope this helps,

Geert

>
> Hi Rifers,
>
> I'm digging through the docs and the examples, but am unable to set  
> the
> template path right. The code I'm refering to is:
> Template template = getHtmlTemplate("../templates/helloworld");
>
> Thats what I want to achive because my "templates" dir is on the same
> dir level as the "classes" dir. Yet somehow I can't go up a level.
> Templates are located through the classpath, which in my case are:
> C:\sun\java\jdk1.6.0_03\lib\tools.jar;
> C:\appData\apache-tomcat-6.0.14\bin\bootstrap.jar
>
> Meanwhile the template dir is:
> C:\appData\apache-tomcat-6.0.14\webapps\rife\WEB-INF\templates
> \helloworld.html
> So, according to the bootstrap path the right path should be
> "../webapps/rife/WEB-INF/templates/helloworld", but that raises the
> error msg: Couldn't find template
> '../webapps/rife/WEB-INF/templates/helloworld'.
>
> Is there a way to use the templates dir on the same level as the  
> classes
> dir or do you have to put the templates and other rife resources  
> all in
> the classes dir?
>
> cheers,
> Artur

--
Geert Bevin
Terracotta - http://www.terracotta.org
Uwyn "Use what you need" - http://uwyn.com
RIFE Java application framework - http://rifers.org
Music and words - http://gbevin.com


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "rife-users" group.
To post to this group, send email to rife-users@...
To unsubscribe from this group, send email to rife-users-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rife-users?hl=en
-~----------~----~----~----~------~----~------~--~---

LightInTheBox - Buy quality products at wholesale price!
 
 
 
Google
rifers.org web