blob: c00a0c1200444890640587288c7987050a26eff6 [file] [log] [blame]
<html>
<head>
<title>Velocity - ParameterParser</title>
<meta name="author" value="Gabriel Sidler"/>
<meta name="email" value="sidler@apache.org" />
</head>
<body bgcolor="#ffffff" text="#000000" link="#525D76"
alink="#525D76" vlink="#525D76">
<table border="0" width="100%" cellspacing="4">
<tr><td colspan="2">
<a href="http://velocity.apache.org/">
<img src="http://velocity.apache.org/images/velocity_project_wide.png"
align="left" alt="The Velocity Project" border="0"/>
</a>
<a href="index.html">
<img src="../images/velocityview.png" align="right" alt="< Tools - View >" border="0"/>
</a>
</td></tr>
<tr>
<td colspan="2">
<hr noshade="" size="1"/>
</td>
</tr>
<tr>
<td width="20%" valign="top" nowrap="true">
<p><strong><a href="../index.html">Velocity Tools</a></strong></p>
<p>
<strong>VelocityView</strong>
</p>
<ul>
<li><a href="index.html">Overview</a></li>
<li><a href="../index.html#Download">Download</a></li>
<li><a href="index.html#Installation">Installation</a></li>
<li><a href="index.html#VelocityLayoutServlet">LayoutServlet</a></li>
<li><a href="index.html#Examples">Examples</a></li>
<li><a href="../javadoc/index.html">Javadoc</a></li>
</ul>
<p>
<strong>VelocityView Tools</strong>
</p>
<ul>
<li><a href="../javadoc/org/apache/velocity/tools/view/tools/AbstractPagerTool.html">AbstractPagerTool</a></li>
<li><a href="../javadoc/org/apache/velocity/tools/view/tools/AbstractSearchTool.html">AbstractSearchTool</a></li>
<li><a href="../javadoc/org/apache/velocity/tools/view/tools/BrowserSnifferTool.html">BrowserSnifferTool</a></li>
<li><a href="../javadoc/org/apache/velocity/tools/view/tools/ContextTool.html">ContextTool</a></li>
<li><a href="../javadoc/org/apache/velocity/tools/view/tools/CookieTool.html">CookieTool</a></li>
<li><a href="ImportTool.html">ImportTool</a></li>
<li><a href="../javadoc/org/apache/velocity/tools/view/tools/LinkTool.html">LinkTool</a></li>
<li><a href="../javadoc/org/apache/velocity/tools/view/tools/ParameterParser.html">ParameterParser</a></li>
<li><a href="ViewRenderTool.html">ViewRenderTool</a></li>
<li><a href="../javadoc/org/apache/velocity/tools/view/tools/ViewResourceTool.html">ViewResourceTool</a></li>
</ul>
<p>
<strong>Other Subprojects</strong>
</p>
<ul>
<li><a href="../generic/">GenericTools</a></li>
<li><a href="../struts/">VelocityStruts</a></li>
</ul>
<p>
</p>
</td>
<!-- RIGHT SIDE MAIN BODY -->
<td colspan="1" valign="top" align="left">
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr>
<td colspan="2" bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica.sanserif">
<a name="ParameterParser Reference Documentation">
<strong>ParameterParser Reference Documentation</strong></a></font>
</td>
</tr>
<tr>
<td NOWRAP> &nbsp; &nbsp; &nbsp; &nbsp; </td>
<td>
<p>View tool for easy parsing of ServletRequest parameters.</p>
<table cellpadding="0" cellspacing="0">
<tr><td colspan="2"><strong>Class</strong></td></tr>
<tr><td>&nbsp;</td><td>org.apache.velocity.tools.view.tools.ParameterParser</td></tr>
<tr><td colspan="2"><strong>Name</strong></td></tr>
<tr><td>&nbsp;</td><td>$params (this is the recommended name of the tool in
the Velocity context)</td></tr>
<tr><td colspan="2"><strong>Toolbox Configuration Example</strong></td></tr>
<tr><td>&nbsp;</td><td><pre>&lt;tool&gt;
&lt;key&gt;params&lt;/key&gt;
&lt;scope&gt;request&lt;/scope&gt;
&lt;class&gt;org.apache.velocity.tools.view.tools.ParameterParser&lt;/class&gt;
&lt;/tool&gt;</pre></td></tr>
<tr><td colspan="2"><strong>Author(s)</strong></td></tr>
<tr>
<td>&nbsp;</td>
<td>Nathan Bubna<br></td>
</tr>
</table>
<dl>
<dt><strong>Method Overview</strong></dt>
<dd>
<table cellpadding="2" cellspacing="2" border="0">
<tr>
<td bgcolor="EEEEEE" nowrap>
<a href="#exists()">exists()</a></td>
<td bgcolor="EEEEEE">
Returns <code>true</code> if a parameter for the specified key exists.
</td>
</tr>
<tr>
<td bgcolor="EEEEEE" nowrap>
<a href="#getString()">getString()</a></td>
<td bgcolor="EEEEEE">
Returns the specified servlet request parameter as a String
</td>
</tr>
<tr>
<td bgcolor="EEEEEE" nowrap>
<a href="#getBoolean()">getBoolean()</a></td>
<td bgcolor="EEEEEE">
Returns the specified servlet request parameter as a Boolean object or
a boolean primitive type
</td>
</tr>
<tr>
<td bgcolor="EEEEEE" nowrap>
<a href="#getNumber()">getNumber()</a></td>
<td bgcolor="EEEEEE">
Returns the specified servlet request parameter as a Number object
</td>
</tr>
<tr>
<td bgcolor="EEEEEE" nowrap>
<a href="#getInt()">getInt()</a></td>
<td bgcolor="EEEEEE">
Returns the specified servlet request parameter as an integer
</td>
</tr>
<tr>
<td bgcolor="EEEEEE" nowrap>
<a href="#getDouble()">getDouble()</a></td>
<td bgcolor="EEEEEE">
Returns the specified servlet request parameter as a double
</td>
</tr>
<tr>
<td bgcolor="EEEEEE" nowrap>
<a href="#getStrings()">getStrings()</a></td>
<td bgcolor="EEEEEE">
Returns an array of Strings of all the values of the specified servlet
request parameter
</td>
</tr>
<tr>
<td bgcolor="EEEEEE" nowrap>
<a href="#getBooleans()">getBooleans()</a></td>
<td bgcolor="EEEEEE">
Returns an array of Booleans of all the values of the specified servlet
request parameter
</td>
</tr>
<tr>
<td bgcolor="EEEEEE" nowrap>
<a href="#getNumbers()">getNumbers()</a></td>
<td bgcolor="EEEEEE">
Returns an array of Numbers of all the values of the specified servlet
request parameter
</td>
</tr>
<tr>
<td bgcolor="EEEEEE" nowrap>
<a href="#getInts()">getInts()</a></td>
<td bgcolor="EEEEEE">
Returns an array of integers of all the values of the specified servlet
request parameter
</td>
</tr>
<tr>
<td bgcolor="EEEEEE" nowrap>
<a href="#getDoubles()">getDoubles()</a></td>
<td bgcolor="EEEEEE">
Returns an array of doubles of all the values of the specified servlet
request parameter
</td>
</tr>
</table>
</dd>
</dl>
</td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr>
<td colspan="2" bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica.sanserif">
<a name="exists()">
<strong>exists()</strong></a></font>
</td>
</tr>
<tr>
<td NOWRAP> &nbsp; &nbsp; &nbsp; &nbsp; </td>
<td>
<p>
<abstract>
Returns <code>true</code> if a parameter for the specified key exists.
</abstract>
</p>
<p>
<table width="100%"><tr><td bgcolor="EEEEEE">
<font size="+1"><code>
<signature>
boolean exists(String key)
</signature>
</code></font>
</td></tr></table>
</p>
<dl>
<dt><strong>Parameters</strong></dt>
<dd>
<dl>
<dt>key</dt>
<dd>
<parameter name="key">
The key of the parameter in question
</parameter>
</dd>
</dl>
</dd>
</dl>
<dl>
<dt><strong>Returns</strong></dt>
<dd>
<returns>
<code>true</code> if a parameter for the specified key exists or
<code>false</code> if this parameter is not present or has no value.
</returns>
</dd>
</dl>
<br clear="all">
</td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr>
<td colspan="2" bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica.sanserif">
<a name="getString()">
<strong>getString()</strong></a></font>
</td>
</tr>
<tr>
<td NOWRAP> &nbsp; &nbsp; &nbsp; &nbsp; </td>
<td>
<p>
<abstract>
Returns the specified servlet request parameter as a String
</abstract>
</p>
<p>
<table width="100%"><tr><td bgcolor="EEEEEE">
<font size="+1"><code>
<signature>
String get(String key)
</signature>
</code></font>
</td></tr></table>
</p>
<p>
<table width="100%"><tr><td bgcolor="EEEEEE">
<font size="+1"><code>
<signature>
String getString(String key)
</signature>
</code></font>
</td></tr></table>
</p>
<p>
<table width="100%"><tr><td bgcolor="EEEEEE">
<font size="+1"><code>
<signature>
String getString(String key, String alternate)
</signature>
</code></font>
</td></tr></table>
</p>
<dl>
<dt><strong>Parameters</strong></dt>
<dd>
<dl>
<dt>key</dt>
<dd>
<parameter name="key">
The key of the desired string parameter
</parameter>
</dd>
<dt>alternate</dt>
<dd>
<parameter name="alternate">
An alternate value
</parameter>
</dd>
</dl>
</dd>
</dl>
<dl>
<dt><strong>Returns</strong></dt>
<dd>
<returns>
The value of the parameter matching the specified key or the
specified alternate String if there is no matching parameter.
A value of <code>null</code> is returned if no alternate value
is defined and the desired parameter is not found.
</returns>
</dd>
</dl>
<br clear="all">
</td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr>
<td colspan="2" bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica.sanserif">
<a name="getBoolean()">
<strong>getBoolean()</strong></a></font>
</td>
</tr>
<tr>
<td NOWRAP> &nbsp; &nbsp; &nbsp; &nbsp; </td>
<td>
<p>
<abstract>
Returns the specified servlet request parameter as a Boolean object or
a boolean primitive type
</abstract>
</p>
<p>
<table width="100%"><tr><td bgcolor="EEEEEE">
<font size="+1"><code>
<signature>
Boolean getBoolean(String key)
</signature>
</code></font>
</td></tr></table>
</p>
<p>
<table width="100%"><tr><td bgcolor="EEEEEE">
<font size="+1"><code>
<signature>
Boolean getBoolean(String key, Boolean alternate)
</signature>
</code></font>
</td></tr></table>
</p>
<p>
<table width="100%"><tr><td bgcolor="EEEEEE">
<font size="+1"><code>
<signature>
boolean getBoolean(String key, boolean alternate)
</signature>
</code></font>
</td></tr></table>
</p>
<dl>
<dt><strong>Parameters</strong></dt>
<dd>
<dl>
<dt>key</dt>
<dd>
<parameter name="key">
The key of the desired string parameter
</parameter>
</dd>
<dt>alternate</dt>
<dd>
<parameter name="alternate">
An alternate value
</parameter>
</dd>
</dl>
</dd>
</dl>
<dl>
<dt><strong>Returns</strong></dt>
<dd>
<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 <code>null</code> is returned if no alternate value
is defined and the desired parameter is not found.
</returns>
</dd>
</dl>
<br clear="all">
</td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr>
<td colspan="2" bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica.sanserif">
<a name="getNumber()">
<strong>getNumber()</strong></a></font>
</td>
</tr>
<tr>
<td NOWRAP> &nbsp; &nbsp; &nbsp; &nbsp; </td>
<td>
<p>
<abstract>
Returns the specified servlet request parameter as a Number object
</abstract>
</p>
<p>
<table width="100%"><tr><td bgcolor="EEEEEE">
<font size="+1"><code>
<signature>
Number getNumber(String key)
</signature>
</code></font>
</td></tr></table>
</p>
<p>
<table width="100%"><tr><td bgcolor="EEEEEE">
<font size="+1"><code>
<signature>
Number getNumber(String key, Number alternate)
</signature>
</code></font>
</td></tr></table>
</p>
<dl>
<dt><strong>Parameters</strong></dt>
<dd>
<dl>
<dt>key</dt>
<dd>
<parameter name="key">
The key of the desired string parameter
</parameter>
</dd>
<dt>alternate</dt>
<dd>
<parameter name="alternate">
An alternate value
</parameter>
</dd>
</dl>
</dd>
</dl>
<dl>
<dt><strong>Returns</strong></dt>
<dd>
<returns>
A <code>java.lang.Number</code> 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 <code>null</code> is returned if no alternate value
is defined and the desired parameter is not found.
</returns>
</dd>
</dl>
<br clear="all">
</td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr>
<td colspan="2" bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica.sanserif">
<a name="getInt()">
<strong>getInt()</strong></a></font>
</td>
</tr>
<tr>
<td NOWRAP> &nbsp; &nbsp; &nbsp; &nbsp; </td>
<td>
<p>
<abstract>
Returns the specified servlet request parameter as an integer
</abstract>
</p>
<p>
<table width="100%"><tr><td bgcolor="EEEEEE">
<font size="+1"><code>
<signature>
int getInt(String key, int alternate)
</signature>
</code></font>
</td></tr></table>
</p>
<dl>
<dt><strong>Parameters</strong></dt>
<dd>
<dl>
<dt>key</dt>
<dd>
<parameter name="key">
The key of the desired string parameter
</parameter>
</dd>
<dt>alternate</dt>
<dd>
<parameter name="alternate">
An alternate value
</parameter>
</dd>
</dl>
</dd>
</dl>
<dl>
<dt><strong>Returns</strong></dt>
<dd>
<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.
</returns>
</dd>
</dl>
<br clear="all">
</td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr>
<td colspan="2" bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica.sanserif">
<a name="getDouble()">
<strong>getDouble()</strong></a></font>
</td>
</tr>
<tr>
<td NOWRAP> &nbsp; &nbsp; &nbsp; &nbsp; </td>
<td>
<p>
<abstract>
Returns the specified servlet request parameter as a double
</abstract>
</p>
<p>
<table width="100%"><tr><td bgcolor="EEEEEE">
<font size="+1"><code>
<signature>
double getDouble(String key, double alternate)
</signature>
</code></font>
</td></tr></table>
</p>
<dl>
<dt><strong>Parameters</strong></dt>
<dd>
<dl>
<dt>key</dt>
<dd>
<parameter name="key">
The key of the desired string parameter
</parameter>
</dd>
<dt>alternate</dt>
<dd>
<parameter name="alternate">
An alternate value
</parameter>
</dd>
</dl>
</dd>
</dl>
<dl>
<dt><strong>Returns</strong></dt>
<dd>
<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.
</returns>
</dd>
</dl>
<br clear="all">
</td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr>
<td colspan="2" bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica.sanserif">
<a name="getStrings()">
<strong>getStrings()</strong></a></font>
</td>
</tr>
<tr>
<td NOWRAP> &nbsp; &nbsp; &nbsp; &nbsp; </td>
<td>
<p>
<abstract>
Returns an array of Strings of all the values of the specified servlet
request parameter
</abstract>
</p>
<p>
<table width="100%"><tr><td bgcolor="EEEEEE">
<font size="+1"><code>
<signature>
String[] getStrings(String key)
</signature>
</code></font>
</td></tr></table>
</p>
<dl>
<dt><strong>Parameters</strong></dt>
<dd>
<dl>
<dt>key</dt>
<dd>
<parameter name="key">
The key of the desired string parameter
</parameter>
</dd>
</dl>
</dd>
</dl>
<dl>
<dt><strong>Returns</strong></dt>
<dd>
<returns>
A array of Strings that represent all the values of the desired
request parameter or <code>null</code> if the parameter does not
exist.
</returns>
</dd>
</dl>
<br clear="all">
</td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr>
<td colspan="2" bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica.sanserif">
<a name="getBooleans()">
<strong>getBooleans()</strong></a></font>
</td>
</tr>
<tr>
<td NOWRAP> &nbsp; &nbsp; &nbsp; &nbsp; </td>
<td>
<p>
<abstract>
Returns an array of Booleans of all the values of the specified servlet
request parameter
</abstract>
</p>
<p>
<table width="100%"><tr><td bgcolor="EEEEEE">
<font size="+1"><code>
<signature>
Boolean[] getBooleans(String key)
</signature>
</code></font>
</td></tr></table>
</p>
<dl>
<dt><strong>Parameters</strong></dt>
<dd>
<dl>
<dt>key</dt>
<dd>
<parameter name="key">
The key of the desired string parameter
</parameter>
</dd>
</dl>
</dd>
</dl>
<dl>
<dt><strong>Returns</strong></dt>
<dd>
<returns>
A array of <code>java.lang.Boolean</code> that represent all the
values of the desired request parameter or <code>null</code> if
the parameter does not exist.
</returns>
</dd>
</dl>
<br clear="all">
</td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr>
<td colspan="2" bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica.sanserif">
<a name="getNumbers()">
<strong>getNumbers()</strong></a></font>
</td>
</tr>
<tr>
<td NOWRAP> &nbsp; &nbsp; &nbsp; &nbsp; </td>
<td>
<p>
<abstract>
Returns an array of Numbers of all the values of the specified servlet
request parameter
</abstract>
</p>
<p>
<table width="100%"><tr><td bgcolor="EEEEEE">
<font size="+1"><code>
<signature>
Number[] getNumbers(String key)
</signature>
</code></font>
</td></tr></table>
</p>
<dl>
<dt><strong>Parameters</strong></dt>
<dd>
<dl>
<dt>key</dt>
<dd>
<parameter name="key">
The key of the desired string parameter
</parameter>
</dd>
</dl>
</dd>
</dl>
<dl>
<dt><strong>Returns</strong></dt>
<dd>
<returns>
A array of <code>java.lang.Number</code> that represent all the
values of the desired request parameter or <code>null</code> if
the parameter does not exist.
</returns>
</dd>
</dl>
<br clear="all">
</td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr>
<td colspan="2" bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica.sanserif">
<a name="getInts()">
<strong>getInts()</strong></a></font>
</td>
</tr>
<tr>
<td NOWRAP> &nbsp; &nbsp; &nbsp; &nbsp; </td>
<td>
<p>
<abstract>
Returns an array of integers of all the values of the specified servlet
request parameter
</abstract>
</p>
<p>
<table width="100%"><tr><td bgcolor="EEEEEE">
<font size="+1"><code>
<signature>
int[] getInts(String key)
</signature>
</code></font>
</td></tr></table>
</p>
<dl>
<dt><strong>Parameters</strong></dt>
<dd>
<dl>
<dt>key</dt>
<dd>
<parameter name="key">
The key of the desired string parameter
</parameter>
</dd>
</dl>
</dd>
</dl>
<dl>
<dt><strong>Returns</strong></dt>
<dd>
<returns>
A array of integer primitive types that represent all the
values of the desired request parameter or <code>null</code> if
the parameter does not exist.
</returns>
</dd>
</dl>
<br clear="all">
</td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr>
<td colspan="2" bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica.sanserif">
<a name="getDoubles()">
<strong>getDoubles()</strong></a></font>
</td>
</tr>
<tr>
<td NOWRAP> &nbsp; &nbsp; &nbsp; &nbsp; </td>
<td>
<p>
<abstract>
Returns an array of doubles of all the values of the specified servlet
request parameter
</abstract>
</p>
<p>
<table width="100%"><tr><td bgcolor="EEEEEE">
<font size="+1"><code>
<signature>
double[] getDoubles(String key)
</signature>
</code></font>
</td></tr></table>
</p>
<dl>
<dt><strong>Parameters</strong></dt>
<dd>
<dl>
<dt>key</dt>
<dd>
<parameter name="key">
The key of the desired string parameter
</parameter>
</dd>
</dl>
</dd>
</dl>
<dl>
<dt><strong>Returns</strong></dt>
<dd>
<returns>
A array of double primitive types that represent all the
values of the desired request parameter or <code>null</code> if
the parameter does not exist.
</returns>
</dd>
</dl>
<br clear="all">
</td>
</tr>
</table>
</td>
</tr>
<!-- FOOTER SEPARATOR -->
<tr>
<td colspan="2">
<hr noshade="" size="1"/>
</td>
</tr>
<!-- PAGE FOOTER -->
<tr><td colspan="2">
<div align="center"><font color="#525D76" size="-1"><em>
Copyright &#169; 1999-2003, Apache Software Foundation
</em></font></div>
</td></tr>
</table>
</body>
</html>