Q:

How to check in a JSP if it is receiving a photo?

I would like to show an objects photo ONLY when there is one in my JSP. I'm using this code and it shows no photo even when there is one...
<c:if test="empty ${contextRoot}/statusphoto/${statusUpdate.photo.id}">  
        <img class="img-responsive full-width" src="${contextRoot}/statusphoto/${statusUpdate.photo.id}" alt=""/>
</c:if>

I can not find any other way to do it.
Thanks in advance.

A:

your logic is backwards, you want to show the img tag when there IS a photo so you need to use not empty and probably only want to check if you have a photo id 
<c:if test="not empty ${statusUpdate.photo.id}">  
        <img class="img-responsive full-width" src="${contextRoot}/statusphoto/${statusUpdate.photo.id}" alt=""/>
</c:if>

