You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Qin Ding <qd...@csc.com> on 2003/10/07 18:25:59 UTC
Please Help
Can someone help me with file.resource.loader.path? I just can't make it
work!
Here is my velocity.properties file:
resource.loader=file
file.resource.loader.class=org.apache.velocity.runtime.resource.loader.FileResourceLoadr
file.resource.loader.path=longlegs/core/template
The package structure:
longlegs is the root of the package. Or the top folder in the jar. The vm
file is in longlegs/core/template/status_report.vm
When I issue ve.getTemplate("status_report.vm"), I got resource not find:
"status_report.vm".
If I have the above mentioned package structure, what's the correct
definition of the path? Right now the only way the system can find the vm
file is when I hard code like this: c:
\some\folder\projects\src\longlegs\core\template. But how am I supposed to
deploy the jar contains something like this.
please help me. Thank you.
qd
----------------------------------------------------------------------------------------
This is a PRIVATE message. If you are not the intended recipient, please
delete without copying and kindly advise us by e-mail of the mistake in
delivery. NOTE: Regardless of content, this e-mail shall not operate to
bind CSC to any order or other contract unless pursuant to explicit written
agreement or government initiative expressly permitting the use of e-mail
for such purpose.
----------------------------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: Please Help
Posted by mailmur <ma...@yahoo.com>.
1) Hardcode rootpaths for FileResourceLoader
No good for servlet deployment
2) Tweak .path value before initing Velocity
Use servletcontext.getRealpath() to construct the
fullpath at runtime, load velocity.properties, modify
.path value, init velocity engine
3) Use Classpathresourceloader
This will use classloader, so you can keep templates
under the webapp folder structure.
I've chosen to use option 2 in my environment.
Fileresourceloader have a better cachereloading
support than classpathloader.
>>>>>>
file.resource.loader.class=org.apache.velocity.runtime.resource.loader.FileResourceLoadr
>
> file.resource.loader.path=longlegs/core/template
>
> The package structure:
> longlegs is the root of the package. Or the top
> folder in the jar. The vm
> file is in longlegs/core/template/status_report.vm
>
> When I issue ve.getTemplate("status_report.vm"), I
> got resource not find:
> "status_report.vm".
__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org