jsp 如何判断图片为空,并自动显示默认图片
我这么写了 可是不好使
<img src= " <%=workerinfo.getPhoto()%> " height= "100 " width= "100 " onerror= "E:\v.jpg "> </img>
谁能告诉我个好使的方法啊?
------解决方案-------------------- <%if(workerinfo.getPhoto() != null){%>
<img src= " <%=workerinfo.getPhoto()%> " height= "100 " width= "100 ">
<%}else{%>
<img src= "E:\v.jpg " height= "100 " width= "100 ">
<%}%>
------解决方案-------------------- <img src= " <%=null!=workerinfo.getPhoto()?workerinfo.getPhoto(): 'E:\v.jpg '%> " height= "100 " width= "100 "> </img>