10

How to check for Empty String/Null String in Struts-JSP page.

Struts Tag - does not works?

minil
  • 6,895
  • 16
  • 48
  • 55

3 Answers3

21

See below:

<c:if test='${not empty param.whatever}'>
   ...
</c:if>
Taylor Leese
  • 51,004
  • 28
  • 112
  • 141
4
<logic:empty param="<%= yourString %>">

or if the string you want to check is a property of a bean :

<logic:empty name="yourBean" property="yourBeanStringProperty">
kgautron
  • 7,915
  • 9
  • 39
  • 60
-5
String foo = null;
if(foo == null or foo.length() ==0) // The string is null
souLTower
  • 1
  • 1