I am using Struts2. And having trouble in test a String for null or empty. The String is in a loop.
What I have done so far is
in Action class I have a List<User>
. User
have id
and name
fields and have getters and setters...
in JSP i am doing like
<s:iterator value="userList" var="user" status="userStatus">
<s:if test"%{user.name != null && user.name != ''}">
${user.name}
<!-- Do some thing... -->
</s:if>
</s:iterator>
Problem is that Its not working :(, I cannot see the names and they are visible if I remove the <s:if>
block.
Try with this
<s:if test="%{#user.name != null && #user.name != ''}">
<s:property value="#user.name"/>
<!-- Do some thing... -->
</s:if>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With