You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Frans Thamura <fr...@meruvian.org> on 2008/03/08 07:07:15 UTC

Load Template from Jar

hi all

i use struts2 with velocity

i just do several testing , the template is velocity, and freemarker :)

i got this

if we put the template in the source, and deploy to WEB-INF/classes

the template loaded perfectly

but when i try to move all the file inside the classes to a .jar and put in
the WEB-INF/lib

i got errror, the template is not found

anyone have this issue, i read and google, and get we must put ObjectFactory
of XWork, i see that struts-default.xml have that bean, so in my opinion, we
dont need it.

right now, my conculsion, velocity / freemarker can be implemented in web
location path or classpath, but still cannot use the jar classpath, must the
folder based classpath, is this opinion right?

anyone can help me out.

Frans

Re: Load Template from Jar

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
Hi Frans,

Be careful not to cross-post questions.  That gets some people very angry.

Velocity's "resource.loader" property is a comma separated value

Struts sets up a VelocityManager, the manager loads velocity.properties 
from a various locations in the webapp/classpath, the VelocityManager 
creates a VelocityEngine, the result prepares a VelocityContext and the 
engine renders the outuput.  The VelocityEngine instance loads the 
Template's.

So, you've setup a velocity.properties file.  I think it needs to 
include something like this:

resource.loader=class,jar

class.resource.loader.class=org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader

jar.resource.loader.class = org.apache.velocity.runtime.resource.loader.JarResourceLoader
jar.resource.loader.path = jar:file:myjar1.jar


Frans Thamura wrote:



> jeromy
>
> i got this JarResourceLoader
>
> but my problem here, i use both the classpath and jarResource
>
> is it possible to mixed both ?
>
> F
>
>   
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG. 
> Version: 7.5.518 / Virus Database: 269.21.6/1318 - Release Date: 7/03/2008 2:01 PM
>   


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


Re: Load Template from Jar

Posted by Frans Thamura <fr...@meruvian.org>.
jeromy

i got this JarResourceLoader

but my problem here, i use both the classpath and jarResource

is it possible to mixed both ?

F

Re: Load Template from Jar

Posted by Frans Thamura <fr...@meruvian.org>.
jeromy

i got this JarResourceLoader

but my problem here, i use both the classpath and jarResource

is it possible to mixed both ?

F

Re: Load Template from Jar

Posted by Frans Thamura <fr...@meruvian.org>.
hi jeromy

i still dont get how can

the template in /WEB-INF/classes work well

but in the /WEB-INF/lib cannot be found

in my experience anything in clasess can be zipped become .jar and put in
the lib

and in my case, i can use the classpath in the classes folder

but in the lib folder

any idea?

F

On Sat, Mar 8, 2008 at 1:29 PM, Jeromy Evans <
jeromy.evans@blueskyminds.com.au> wrote:

>
> So this thread didn't help ?
>
> http://www.mail-archive.com/user@struts.apache.org/msg73528.html
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
-- 
Frans Thamura
Director
Meruvian
Redefining Civilization
Indonesia

Education, Consulting, Networking, Profesional Marketplace, OpenSource
Development and Implementation

Mobile: +62 855 7888 699
Skype: fthamura
YM: fthamura@yahoo.com
GoogleTalk: frans@meruvian.org
MSN: fthamura@hotmail.com

Sun Java Champion
Oracle Ace Director
JEDI Indonesia / JENI Team
JUG Indonesia Founder
jTechnopreneur Community Founder

Blogs:
http://www.jroller.com/fthamura (English)
http://www.nagasakti.or.id/roller/page/fthamura (Indonesia : Motivation Blog

Linkedin: http://www.linkedin.com/in/fthamura

Re: Load Template from Jar

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
So this thread didn't help ?

http://www.mail-archive.com/user@struts.apache.org/msg73528.html



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