Skip to content Skip to sidebar Skip to footer

How To Display "no Result Found" Using Arraylist In Struts2

Here I am firing some query ..and it displays record but what i want is if there is no record then it should display 'no match/result found' . I am using ArrayList in Struts2 . So

Solution 1:

You can use <s:if> and <s:else> tags of struts2 to check whether the list is empty or not, for example

<s:if test="%{bookResultList.size>0}">
  <table>
     <s:iterator value="bookResultList">
        <tr>      
          <td><s:property value="bookName"/></td>
          <td><s:property value="bookCost"/></td>                
       </tr>
    </s:iterator>
 </table>
 </s:if>
<s:else>
    <div> No data found</div>
</s:else>

In case Struts1.x version, you can use <logic:present> tag. Hope this helps.


Post a Comment for "How To Display "no Result Found" Using Arraylist In Struts2"