tags:

views:

15

answers:

1

Is there an empty keyword in Struts 2 (like in JSP)?

For example in JSP I write:

<c:if test="${empty var}">

Thanks

A: 

Just test for null.

And to acheive the same effect than the JSTL empty keyword with strings (which means "null or empty"), you need two checks (yes it is tiresome):

<s:if test="foo != null && foo != ''">
Samuel_xL
Yeah this is what I'm doing now, but it's not the same check "empty" does. For example an array with no elements should be empty, a blank string like " " too, etc. Thanks though.
Marco