velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cedric Puchalver <>
Subject http referer variable
Date Fri, 01 Mar 2013 10:47:42 GMT

I'm new to velocity. In my company we are using a webapp (OpenEMM - to handle our mailing campaigns and this app is 
using velocity 1.4.

We have two websites and we set a single form to subscribe to two 
different mailing-lists, one for each website... I want to use a 
different css in our form based on the http referer header.

Here what I've tried with no avail :

#set($referer = $request.getHeader('Referer')
#if($referer =="")
   <link href=""  media="all" rel="stylesheet" type="text/css"
#elseif($referer =="")
   <link href=""  media="all" rel="stylesheet" type="text/css"

Here the output in the velocity log :

org.apache.velocity.runtime.exception.ReferenceException: reference : template = null : $referer
is not a valid reference.

Any idea of what's going wrong?

General season signature

*Cedric Puchalver*

111, Route de la Valentine, lot n° 11

13011 Marseille


Phone +33 [0]4 86 778 125

Fax +33 [0]4 91 80 00 37 <>

*Please conserve paper / print only if necessary*

Season of Mist banner <>

*Important:* This e-mail may contain confidential information. If you 
are not the intended recipient it may be unlawful for you to read, copy, 
distribute, disclose or otherwise use information contained in it. If 
this is the case, please contact us immediately by e-mail : Reply to sender.

Errors and omissions may occur in the contents of this e-mail. The 
sender accepts no responsibility for any such errors or omissions, and 
you are advised to confirm the accuracy of its contents before relying 
on it for any purpose.

To the extent that this e-mail is not an official communication of the 
Company, the sender is acting neither as an agent, representative nor in 
any other capacity for or on behalf of the Company.

View raw message