G
Guest
Gast
Hallo Leute!
Frage zum Velocity:
Da ich mich nicht wirklich gut auskenne, habe ich mal angefangen... Leider komme
ich nicht wirklich weit, da eine Exception dies schon weit am Anfang verhindert.
Was ist zu tun? Das Template liegt sicher in dem Verzeichnis. Warum wird das nicht gefunden?
Danke für Antworten,
gondor(..)
Frage zum Velocity:
Da ich mich nicht wirklich gut auskenne, habe ich mal angefangen... Leider komme
ich nicht wirklich weit, da eine Exception dies schon weit am Anfang verhindert.
Code:
public static void main(String[] args) {
StringWriter sw = new StringWriter();
try {
Velocity.init();
VelocityContext context = new VelocityContext();
context.put("name", new String("Velocity") );
Template template = Velocity.getTemplate("g:\\example.vm");
template.merge(context,sw);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Code:
org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource 'g:\example.vm'
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.getTemplate(RuntimeInstance.java:831)
at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:813)
at org.apache.velocity.runtime.RuntimeSingleton.getTemplate(RuntimeSingleton.java:285)
at org.apache.velocity.app.Velocity.getTemplate(Velocity.java:469)
at Test.main(Test.java:50)
Was ist zu tun? Das Template liegt sicher in dem Verzeichnis. Warum wird das nicht gefunden?
Danke für Antworten,
gondor(..)