JBoss Community

Re: Migrating from AS4 to AS7 - Problem loading view templates

created by Neil Doshi in JBoss AS 7 Development - View the full discussion

It turns out the problem was that in JBoss4 I was easily able to access anything under WEB-INF from the classloader.

In JBoss7 I need to move the velocity folder from WEB-INF to WEB-INF/classes.

I also had to update all the spring configuration and references to those files.

 

 

Spring configuration file:

<bean id="velocityConfigurer" class="org.springframework.web.servlet.view.velocity.VelocityConfigurer">

<property name="resourceLoaderPath" value="/WEB-INF/classes/velocity" />

<property name="configLocation" value="/WEB-INF/classes/velocity/velocity.properties"/>

</bean>

 

 

<bean id="viewResolver" class="org.springframework.web.servlet.view.velocity.VelocityLayoutViewResolver">

<property name="prefix" value="" />

<property name="suffix" value=".vm" />

...

...

...

</bean>

 

 

Velocity template files:

Before:

#set( $layout = "WEB-INF/velocity/layout/blank_layout.vm" )

 

After:

#set( $layout = "velocity/layout/blank_layout.vm" )

 

 

Velocity.properties file:

Before:

velocimacro.library = vm_global_library.vm

 

After:

velocimacro.library = velocity/vm_global_library.vm

Reply to this message by going to Community

Start a new discussion in JBoss AS 7 Development at Community