First question -- is Inventory an instance variable in your context, or is
getAllCars a static method on the Inventory class? If it's not an instance
in your context, it needs to be. I know of no feature in velocity that
allows you to access static methods on classes. This also applies for static
properties (or any public properties for that matter). Velocity will not
access a property such as CT_MANUAL -- instead, you'll need to either pass
that value into your context or define a getter method to retrieve the
value.

Second -- Why the braces in this statement:
#set ($availableCars = $Inventory.getAllCars([$mfr, $model,
$cars.CT_MANUAL])) 
                                             ^here                         ^
and here

If you're passing in parameters to a method such as getAllCars(String,
String, int) no braces are necessary, just the commas which you have already
supplied. 

Hope this helps.

- Justin

-----Original Message-----
From: Scott Chun [mailto:[EMAIL PROTECTED]
Sent: Friday, February 28, 2003 6:14 PM
To: [EMAIL PROTECTED]
Subject: Newbie: returning a reference to a List


I'm getting the following error message when attempting to set a variable
with a
List type.

[error] RHS of #set statement is null. Context will not be modified. view.vm
[line 29, column 8]

#set ($car = $Driver.getCar())
#set ($mfr = $car.getManufacturer())
#set ($model = $car.getModel())
#set ($availableCars = $Inventory.getAllCars([$mfr, $model,
$cars.CT_MANUAL])) 
##<= error line

$Driver is supplied by the servlet by: ctx.put("Driver", driver);

getManufacturer() returns a String

getModel() returns a String

CT_MANUAL is defined as: public static final int CT_MANUAL = 1;

getAllCars(String, String, int) returns a List of all available cars that
match
the specifications.

Does this code even make sense?

Thanks in advance!


----------------------------------------------------------------------------
--
This message may contain confidential information, and is intended only for
the use of the individual(s) to whom it is addressed.


============================================================================
==


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to