velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Nicolici <dan.nicol...@nexource.ro>
Subject Webapp resource loader problem
Date Wed, 02 May 2007 07:19:26 GMT
Hi, all!

I'm using VelocityViewServlet in my webapp and I came across a weird 
problem. Every time I open a new browser window and call my webapp URL, 
the variables from my .vm are shown instead of the desired content (like 
$varname). This only happens the on first access on a new browser 
window. After I hit refresh in the browser everything is ok (I get the 
desired content). Then, if I open a new instance of the browser, the 
same thing happens all over again (the webserver is not shutdown between 
the two actions).

I am using Tomcat 5.5. The servlet is declared in the web.xml like this:

    <servlet>
        <servlet-name>MyServlet</servlet-name>
        <servlet-class>
           package.UsersServlet
        </servlet-class>
        <init-param>
            <param-name>org.apache.velocity.properties</param-name>
            <param-value>/WEB-INF/velocity.properties</param-value>
        </init-param>       
    </servlet>

    <servlet-mapping>
        <servlet-name>MyServlet</servlet-name>
        <url-pattern>/index.html</url-pattern>
    </servlet-mapping>

velocity.properties looks like this:

resource.loader = webapp
webapp.resource.loader.class = 
org.apache.velocity.tools.view.servlet.WebappLoader
webapp.resource.loader.path = /templates
# Set cache to true for production
webapp.resource.loader.cache = false
webapp.resource.loader.modificationCheckInterval = 60
velocimacro.library = myMacro.vm

Can you please help me in getting the right content from the first page 
access? What am I doing wrong (cause I must be doing something wrong)?


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


Mime
View raw message