I need to test whether a resource file (an image, for instance) exists and if not, I will display another image. My GSP view code looks like:
<% if (resExists(dir: "images", file:"img.jpg")) {%>
<img src="${g.resource(dir:'images',file: 'img.jpg')}">
<% else { %>
<img src="${g.resource(dir:'images',file: 'noimg.jpg')}">
<%}%>
How can I test for a file existence in Grails? What is the code of the method boolean resExists()