Added getParameter().

git-svn-id: https://samskivert.googlecode.com/svn/trunk@98 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2001-03-15 19:33:37 +00:00
parent f0d5d50fe3
commit 53d7315932
@@ -1,5 +1,5 @@
// //
// $Id: FormUtil.java,v 1.4 2001/03/04 08:18:28 mdb Exp $ // $Id: FormUtil.java,v 1.5 2001/03/15 19:33:37 mdb Exp $
package com.samskivert.webmacro; package com.samskivert.webmacro;
@@ -65,6 +65,22 @@ public class FormUtil
return parseDateParameter(context.getForm(name), invalidDataMessage); return parseDateParameter(context.getForm(name), invalidDataMessage);
} }
/**
* Fetches the supplied parameter from the request. If the parameter
* does not exist, either null or the empty string will be returned
* depending on the value of the <code>returnNull</code> parameter.
*/
public static String getParameter (WebContext context, String name,
boolean returnNull)
{
String value = context.getForm(name);
if (returnNull || !StringUtil.blank(value)) {
return value;
} else {
return "";
}
}
/** /**
* Fetches the supplied parameter from the request and converts it to * Fetches the supplied parameter from the request and converts it to
* a date. The value of the parameter should be a date formatted like * a date. The value of the parameter should be a date formatted like