You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Abdallah Salah Raiyan <ab...@gmail.com> on 2005/10/16 10:25:37 UTC

#include script for local file is failed

Hi all,
 I am trying to use the #include script in the Template to import a local
file (javaScript file):
 <!--TextArea.vm - begin-->
........
#include( "file.js" )
<textarea value="$!wrt.value" ...........>
$!wrt.htmlBody
</textarea>
...............
<!--TextArea.vm - end-->
 The file is located under the TEMPLATE_ROOT which i configure it in the
velocity.properties:
 .........
resource.loader = fileResource, classResource
#---------File path--Loader-----------------
fileResource.resource.loader.description = Velocity File Resource Loader
fileResource.resource.loader.class =
org.apache.velocity.runtime.resource.loader.FileResourceLoader
fileResource.resource.loader.path = framework/web/velocity/template
fileResource.resource.loader.cache = true
fileResource.resource.loader.modificationCheckInterval = 2
#---------Classpath--Loader-----------------
classResource.resource.loader.description = Velocity Classpath Resource
Loader
classResource.resource.loader.class =
org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
...........
 Is that what i set for the TEMPLATE_ROOT in the velocity.properties OK.!!!?
 So i get the following ResourceNotFoundException:
 org.apache.velocity.exception.ResourceNotFoundException: Unable to find
resource 'MyJsFile.js'
at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(
ResourceManagerImpl.java:458)
at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(
ResourceManagerImpl.java:341)
at org.apache.velocity.runtime.RuntimeInstance.getContent(
RuntimeInstance.java:868)
at org.apache.velocity.runtime.directive.Include.renderOutput(Include.java
:193)
at org.apache.velocity.runtime.directive.Include.render(Include.java:137)
at org.apache.velocity.runtime.parser.node.ASTDirective.render(
ASTDirective.java:114)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:55)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(
ASTIfStatement.java:70)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java
:230)
at org.apache.velocity.Template.merge(Template.java:256)
 Any Suggestion..!!

Thanks in Advance
Abdallah

Re: #include script for local file is failed

Posted by Will Glass-Husain <wg...@forio.com>.
Look at the error message again.  It's a different file.

WILL

----- Original Message ----- 
From: "Abdallah Salah Raiyan" <ab...@gmail.com>
To: <ve...@jakarta.apache.org>
Sent: Sunday, October 16, 2005 1:25 AM
Subject: #include script for local file is failed


Hi all,
 I am trying to use the #include script in the Template to import a local
file (javaScript file):
 <!--TextArea.vm - begin-->
........
#include( "file.js" )
<textarea value="$!wrt.value" ...........>
$!wrt.htmlBody
</textarea>
...............
<!--TextArea.vm - end-->
 The file is located under the TEMPLATE_ROOT which i configure it in the
velocity.properties:
 .........
resource.loader = fileResource, classResource
#---------File path--Loader-----------------
fileResource.resource.loader.description = Velocity File Resource Loader
fileResource.resource.loader.class =
org.apache.velocity.runtime.resource.loader.FileResourceLoader
fileResource.resource.loader.path = framework/web/velocity/template
fileResource.resource.loader.cache = true
fileResource.resource.loader.modificationCheckInterval = 2
#---------Classpath--Loader-----------------
classResource.resource.loader.description = Velocity Classpath Resource
Loader
classResource.resource.loader.class =
org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
...........
 Is that what i set for the TEMPLATE_ROOT in the velocity.properties OK.!!!?
 So i get the following ResourceNotFoundException:
 org.apache.velocity.exception.ResourceNotFoundException: Unable to find
resource 'MyJsFile.js'
at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(
ResourceManagerImpl.java:458)
at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(
ResourceManagerImpl.java:341)
at org.apache.velocity.runtime.RuntimeInstance.getContent(
RuntimeInstance.java:868)
at org.apache.velocity.runtime.directive.Include.renderOutput(Include.java
:193)
at org.apache.velocity.runtime.directive.Include.render(Include.java:137)
at org.apache.velocity.runtime.parser.node.ASTDirective.render(
ASTDirective.java:114)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:55)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(
ASTIfStatement.java:70)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java
:230)
at org.apache.velocity.Template.merge(Template.java:256)
 Any Suggestion..!!

Thanks in Advance
Abdallah


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