I'm developing a simple mail sender as Java EE application.
The project structure is shown as follows:
To properly setup email contents, I need to read the *.vm
files placed inside the resource folder, that I supposed to have as path classpath:/templates/mail/*.vm
(as with Spring)... But my supposition is wrong!
Which is the right path to use?
Should I have to use the
META-INF
folder? Is this solution more java-ee-compliant? In that case, where have I to put theMETA-INF
folder inside my project structure?
Update:
I packaged the project as .war
, then I putted the files in:
/src/main/webapp/WEB-INF/classes/templates/mail/
Then:
org.apache.velocity.Template t = myVelocityEngine.getTemplate("classpath:/templates/mail/account_to_confirm.vm",
"UTF-8");
Nonetheless, the app returns an error at runtime:
Unable to find resource 'classpath:/templates/mail/account_to_confirm.vm'
What am I doing wrong?
Just to better understand:
Supposing that I'd like to deploy this app as jar
(removing the servlet class, of course): in that case, should I have to edit the folder layout in order to still use the same path into the source code?