Q:

How to check if my value is null or empty?

In my JSP code I have the following:
<s:iterator value="details" id="cle" status="rowCle">
    <s:iterator value="value" status="row" >
     <tr>
       <s:if test="%{#surname== ''}">
        <td>&nbsp;</td>
       </s:if>
       <s:else>
            <td class="reference"><s:property value="%{getText(key.longname.toLowerCase()) }" /></td>
       </s:else>

Depending on the value of surname (which is a field with getter in my object details, so it is in the value stack) I want to display the value longname or blank.
I have no problem to display {getText(key.longname.toLowerCase()), I also display surname later in my code, so my only concern is about testing the content of surname to check if it is null or empty.
I have tried several options such as 
"%{#surname== ''}">
%{surname== null}'>
'%{#surname== null}'>

but none works. 
I am a bit lost. anybody would have a solution please?
Thank you.
B.

A:

Its better using validation.So that these validation codes will be removed from view layer(JSP). You can inherit method validate() to your action class by extending ActionSupport.
Add your validation codes here.If validation catch any error it will show above the jsp page textbox.

