[jboss-dev-forums] [JBoss AS 7 Development] - Re: Migrating from AS4 to AS7 - Problem loading view templates

Neil Doshi do-not-reply at jboss.com
Thu Sep 20 10:31:43 EDT 2012


Neil Doshi [https://community.jboss.org/people/ndoshi] created the discussion

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

To view the discussion, visit: https://community.jboss.org/message/760634#760634

--------------------------------------------------------------
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
[https://community.jboss.org/message/760634#760634]

Start a new discussion in JBoss AS 7 Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2225]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20120920/1de88179/attachment.html 


More information about the jboss-dev-forums mailing list