Imposing Image Conditions
I am still new to JSP and I need some help on how to implement two more conditions to this exisiting chunk of code (see below). My intention is to impose three conditions in which the image will load.
<tr>
<td width="100%" align="center">
<% if (patron != null) { %>
<% if ((patron.getImage() == null) || (patron.getImage().equals(""))) { %>
<img src="../photos/replacement.gif">
<% } else { %>
<img alt="<%=patron.getImage() %>" src="../../elmu/index.jsp?module=ROOT&action=photo.jsp&id=<%=user. getPatronId()%>">
<% }
}
%>
</td>
</tr>
This is one of the conditions that i've imposed.
1.The first condition is where replacement.gif will be loaded if the value of the data in the column (in database) is either null or blank. Otherwise, it will go to the picture directory and opens the file.
2. The second one that I want to implement is whereby it checks for the existence of the file and if it doesn't exist then it returns replacement.gif.
3. The third one is reading the types of file accepted. If the file format is not (png, gif, or jpeg), then replacement.gif will be loaded.
I need help on implementing the last two conditions. Any help would be beneficial. Thank you.
Keep doing more...:)
|