tags:

views:

1144

answers:

2

E.g.

<c:if test="${post}">
    <h3>${post.title}</h3> 
</c:if>
+5  A: 

Use the empty keyword

<c:if test="${not empty post}">
   <h3>${post.title}</h3>   
</c:if>
krosenvold
This is definitely the best way. I believe it also checks for `null`.
atc
A: 

How can I check if the property exists in Command object? There is no property of "title" exists in command bean.

<c:if test="${empty command.title}">
  <h1>this throws exception</h1>
</c:if>
Garry
Welcome at Stackoverflow! Oops, you've posted a *question* as an **answer**. This is not the way how it works here. If you have a question, you should press the `Ask Question` button at right top, not the `Post Your Answer` button at the bottom :) Cheers!
BalusC