The Velocity Project < Tools - View >

Velocity Tools

VelocityView

VelocityView Tools

Other Subprojects

ParameterParser Reference Documentation
       

View tool for easy parsing of ServletRequest parameters.

Class
 org.apache.velocity.tools.view.tools.ParameterParser
Name
 $params (this is the recommended name of the tool in the Velocity context)
Toolbox Configuration Example
 
<tool>
  <key>params</key>
  <scope>request</scope>
  <class>org.apache.velocity.tools.view.tools.ParameterParser</class>
</tool>
Author(s)
  Nathan Bubna
Method Overview
exists() Returns true if a parameter for the specified key exists.
getString() Returns the specified servlet request parameter as a String
getBoolean() Returns the specified servlet request parameter as a Boolean object or a boolean primitive type
getNumber() Returns the specified servlet request parameter as a Number object
getInt() Returns the specified servlet request parameter as an integer
getDouble() Returns the specified servlet request parameter as a double
getStrings() Returns an array of Strings of all the values of the specified servlet request parameter
getBooleans() Returns an array of Booleans of all the values of the specified servlet request parameter
getNumbers() Returns an array of Numbers of all the values of the specified servlet request parameter
getInts() Returns an array of integers of all the values of the specified servlet request parameter
getDoubles() Returns an array of doubles of all the values of the specified servlet request parameter
exists()
       

Returns true if a parameter for the specified key exists.

boolean exists(String key)

Parameters
key
The key of the parameter in question
Returns
true if a parameter for the specified key exists or false if this parameter is not present or has no value.

getString()
       

Returns the specified servlet request parameter as a String

String get(String key)

String getString(String key)

String getString(String key, String alternate)

Parameters
key
The key of the desired string parameter
alternate
An alternate value
Returns
The value of the parameter matching the specified key or the specified alternate String if there is no matching parameter. A value of null is returned if no alternate value is defined and the desired parameter is not found.

getBoolean()
       

Returns the specified servlet request parameter as a Boolean object or a boolean primitive type

Boolean getBoolean(String key)

Boolean getBoolean(String key, Boolean alternate)

boolean getBoolean(String key, boolean alternate)

Parameters
key
The key of the desired string parameter
alternate
An alternate value
Returns
A Boolean object or boolean primitive type that represents the value of the servlet request parameter matching the specified key or the specified alternate boolean if there is no matching parameter. A value of null is returned if no alternate value is defined and the desired parameter is not found.

getNumber()
       

Returns the specified servlet request parameter as a Number object

Number getNumber(String key)

Number getNumber(String key, Number alternate)

Parameters
key
The key of the desired string parameter
alternate
An alternate value
Returns
A java.lang.Number object that represents the value of the servlet request parameter matching the specified key or the specified alternate Number if there is no matching parameter. A value of null is returned if no alternate value is defined and the desired parameter is not found.

getInt()
       

Returns the specified servlet request parameter as an integer

int getInt(String key, int alternate)

Parameters
key
The key of the desired string parameter
alternate
An alternate value
Returns
An integer that represents the value of the servlet request parameter matching the specified key or the specified alternate value if there is no matching parameter.

getDouble()
       

Returns the specified servlet request parameter as a double

double getDouble(String key, double alternate)

Parameters
key
The key of the desired string parameter
alternate
An alternate value
Returns
An double that represents the value of the servlet request parameter matching the specified key or the specified alternate value if there is no matching parameter.

getStrings()
       

Returns an array of Strings of all the values of the specified servlet request parameter

String[] getStrings(String key)

Parameters
key
The key of the desired string parameter
Returns
A array of Strings that represent all the values of the desired request parameter or null if the parameter does not exist.

getBooleans()
       

Returns an array of Booleans of all the values of the specified servlet request parameter

Boolean[] getBooleans(String key)

Parameters
key
The key of the desired string parameter
Returns
A array of java.lang.Boolean that represent all the values of the desired request parameter or null if the parameter does not exist.

getNumbers()
       

Returns an array of Numbers of all the values of the specified servlet request parameter

Number[] getNumbers(String key)

Parameters
key
The key of the desired string parameter
Returns
A array of java.lang.Number that represent all the values of the desired request parameter or null if the parameter does not exist.

getInts()
       

Returns an array of integers of all the values of the specified servlet request parameter

int[] getInts(String key)

Parameters
key
The key of the desired string parameter
Returns
A array of integer primitive types that represent all the values of the desired request parameter or null if the parameter does not exist.

getDoubles()
       

Returns an array of doubles of all the values of the specified servlet request parameter

double[] getDoubles(String key)

Parameters
key
The key of the desired string parameter
Returns
A array of double primitive types that represent all the values of the desired request parameter or null if the parameter does not exist.


Copyright © 1999-2003, Apache Software Foundation