velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "brian" <br...@westpole.com>
Subject RE: rendering velocity in websphere
Date Wed, 02 Jun 2004 23:32:44 GMT
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app id="WebApp">
   <display-name>glo</display-name>
   <servlet>
	 <servlet-name>glostage</servlet-name>
	 <display-name>GLO Application</display-name>
     <description>This is the initial servlet.</description>
     <servlet-class>org.apache.turbine.Turbine</servlet-class>
	 <init-param>
       <param-name>applicationRoot</param-name>
       <param-value>webContext</param-value>
     </init-param>
	 <init-param>
       <param-name>properties</param-name>
 
<param-value>/WEB-INF/conf/TurbineResources.properties</param-value>
     </init-param>
     <load-on-startup></load-on-startup>
    </servlet>

    <servlet>
	 <servlet-name>velocity</servlet-name>
	 <display-name>velocity servlet</display-name>
     <description>This is the initial velocity servlet.</description>
 
<servlet-class>org.apache.velocity.tools.view.servlet.VelocityLayoutServ
let</servlet-class>      
	 
	  <init-param>
      <param-name>org.apache.velocity.properties</param-name>
      <param-value>/WEB-INF/TurbineResources.properties</param-value>
      </init-param>
      <load-on-startup></load-on-startup>
	 </servlet>

     <servlet-mapping>
     <servlet-name>glostage</servlet-name>
     <url-pattern>/glostage/servlet/glostage</url-pattern>
     </servlet-mapping>

     <servlet-mapping>
     <servlet-name>velocity</servlet-name>
     <url-pattern>*.vm</url-pattern>
     </servlet-mapping>

      <session-config id="SessionConfig_1">
     <session-timeout>10</session-timeout>
     </session-config>
   <welcome-file-list id="WelcomeFileList_1">
     <welcome-file>/templates/app/screens/Login.vm</welcome-file>
   </welcome-file-list>

    <security-constraint>
    <web-resource-collection>
      <web-resource-name>templates</web-resource-name>
      <url-pattern>/templates/*</url-pattern>
    </web-resource-collection>
    <web-resource-collection>
      <web-resource-name>logs</web-resource-name>
      <url-pattern>/logs/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
      <role-name>admin</role-name>
    </auth-constraint>
  </security-constraint>
  <login-config>
    <auth-method>BASIC</auth-method>
    <realm-name>Templates</realm-name>
  </login-config>

</web-app>

entries in properties file:
# -------------------------------------------------------------------
#
#  V E L O C I T Y  S E R V I C E
#
# -------------------------------------------------------------------

services.VelocityService.earlyInit= true

# The location of Velocity configuration file, relative to webapp root
# These properties will override the default properties set by Velocity.
# You should specify the path to the templates directories as well as
# the path to the log file and they should also be relative to webapp
root

#services.VelocityService.template.extension=vm
#services.VelocityService.default.page = VelocityPage
#services.VelocityService.default.screen=VelocityScreen
#services.VelocityService.default.layout = VelocityOnlyLayout
#services.VelocityService.default.navigation=VelocityNavigation
#services.VelocityService.default.error.screen = VelocityErrorScreen
#services.VelocityService.default.layout.template = Default.vm

# Filepath for error template, 
#  relative to web application root directory
tools.view.servlet.error.template = Error.vm

# Directory for layout templates, 
#  relative to web application root directory
tools.view.servlet.layout.directory = layouts/

# Filepath of the default layout template 
#  relative to the layout directory 
#  NOT relative to the root directory of the webapp!
tools.view.servlet.layout.default.template =  Login.vm

#
# Set this to true to catch Velocity Errors and display them in the log
file
services.VelocityService.catch.errors = true

services.VelocityService.runtime.log=/logs/velocity.log
#services.VelocityService.input.encoding=UTF-8

# global macros are in the /templates folder for your use
services.VelocityService.velocimacro.library = GlobalMacros.vm

# TurbineMacros are within the turbine jar and allow some nice page
building techniques
services.VelocityService.velocimacro.library = macros/TurbineMacros.vm

# Set the following line to true to cause velocity to automatically
reload
# library macro files if they change.  This is useful for debugging.
services.VelocityService.velocimacro.library.autoreload = false

services.VelocityService.resource.loader = file
services.VelocityService.file.resource.loader.description = Velocity
File Resource Loader
services.VelocityService.file.resource.loader.class =
org.apache.velocity.runtime.resource.loader.FileResourceLoader
services.VelocityService.file.resource.loader.path =
/templates/app,/templates/flux
services.VelocityService.file.resource.loader.cache = false
services.VelocityService.file.resource.loader.modificationCheckInterval
= 2

#
# Do not remove the class path loader lightly, it is used to load the
TurbineMacros from VelocityOnlyLayout
#
services.VelocityService.resource.loader = classpath
services.VelocityService.classpath.resource.loader.description =
Velocity Classpath Resource Loader
services.VelocityService.classpath.resource.loader.class =
org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader

-----Original Message-----
From: Nathan Bubna [mailto:nathan@esha.com] 
Sent: Wednesday, June 02, 2004 6:42 PM
To: Velocity Users List
Subject: Re: rendering velocity in websphere

brian said:
> I have read
> http://jakarta.apache.org/velocity/tools/view/layoutservlet.html and
> http://www.catb.org/~esr/faqs/smart-questions.html.

thanks, i feel much better now. :)

> I am trying to set
> the layout using #set($layout="Login.vm") at the top of my screen. I
get
> a "Unable to find resource 'layout/Default.vm'" error when I try to
> access the servlet from the browser. I even tried to change the
default
> layout value in the properties file.
...

ok, can you show us what your web.xml looks like?  it sounds like the
problem
might be there.  also, if you have any custom velocity properties
(particularly pertaining to resource loaders or the layout servlet),
could you
include those snippets?

Nathan Bubna
nathan@esha.com


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


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


Mime
View raw message