/*
* OPIAM Suite
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package opiam.admin.faare.struts.utils;
import java.util.ArrayList;
import java.util.StringTokenizer;
/**
* This class contains utility methods for HTML forms processing.
*/
public final class FormUtils
{
/** Utility class. */
private FormUtils()
{
}
/**
* This method must be called by an edition FormBean to get the values of
* a multivalued attribute filled by the MultiEdit tag.
*
* @param desc value gor from the form
* @return list of values of the attribute
*/
public static ArrayList getMultiVal(String desc)
{
if (desc.trim().equals(""))
{
return null;
}
desc = desc.substring(1);
StringTokenizer tok = new StringTokenizer(desc, "#");
ArrayList vals = new ArrayList();
while (tok.hasMoreTokens())
{
String aval = tok.nextToken();
if (!aval.trim().equals(""))
{
vals.add(aval);
}
}
if (vals.size() == 0)
{
vals = null;
}
return vals;
}
}