Я использовал (в .NET v2.0):
public static class StringExtensions
{
public static bool IsNullOrEmptyOrWhitespace(this string value)
{
return string.IsNullOrEmpty(value) || string.IsNullOrEmpty(value.Trim());
}
}
Метод Trim()
удалит все начальные или конечные пробелы, поэтому, если ваша строка полностью пустая, она будет уменьшена до пустая строка.
Я не могу сказать, что производительность была проблемой.
If I understand it correctly, you just want different name for each hidden field?
<s:iterator value="bars" status="key">
<s:hidden name="bar.foos[%{#key.index}].attr1" value="attr1" />
<s:hidden name="bar.foos[%{#key.index}].attr2" value="attr2" />
</s:iterator>
which should give you the equivalent of
<input type="hidden" name="bar.foos[0].attr1" value="some value" />
<input type="hidden" name="bar.foos[0].attr2" value="some other value" />
<input type="hidden" name="bar.foos[1].attr1" value="some value" />
<input type="hidden" name="bar.foos[1].attr2" value="some other value" />
If you have proper getter/setter, it should set all the values when the form is being submitted.