Check empty string in jsp
Asked Answered
B

3

10

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

Struts Tag - does not works?

Boon answered 3/8, 2010 at 17:28 Comment(0)
L
21

See below:

<c:if test='${not empty param.whatever}'>
   ...
</c:if>
Lands answered 3/8, 2010 at 17:31 Comment(0)
J
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">
Janellajanelle answered 12/12, 2010 at 13:31 Comment(0)
M
-5
String foo = null;
if(foo == null or foo.length() ==0) // The string is null
Martinson answered 3/8, 2010 at 17:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.