我在应用程序中使用Struts2。我有一个HTML<img>
标记,对于src
,我正在使用Struts2属性值。属性的值是图像名称(来自数据库)。我尝试了这个
<s:iterator value="items" var="items">
<img onerror = "this.style.display='none'"
src = 'D:/product_images/<s:property value="image"/>'
style = "width: 290px; height: 260px"
/>
<s:label label="Imge path" value='D:/product_images/%{image}'/>
</s:iterator>
我的Struts标签显示了正确的路径。但是当我声明src
为属性时,该图像不可见。如何正确给出img
标签src
属性的路径?
提前致谢!
路径应在服务器或应用程序中配置。就像在这个例子中一样。
<img onerror = "this.style.display='none'"
src = "<s:url action='ImageAction'><s:param name="imageId" value="%{image}"/></s:url>"
style = "width: 290px; height: 260px"/>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句