diff --git a/projects/samskivert/src/java/com/samskivert/webmacro/FormUtil.java b/projects/samskivert/src/java/com/samskivert/webmacro/FormUtil.java index 421eec6c..3ae380a2 100644 --- a/projects/samskivert/src/java/com/samskivert/webmacro/FormUtil.java +++ b/projects/samskivert/src/java/com/samskivert/webmacro/FormUtil.java @@ -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; @@ -65,6 +65,22 @@ public class FormUtil 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 returnNull 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 * a date. The value of the parameter should be a date formatted like