public class product {
private String name;
private String path;
// and getter setter of attributes
}
我想从bean中获取path
值,并在“img src”标记中提供此路径值。
我知道打印路径属性值,但我的问题是在img标签中使用此路径值来上传此图像
答案 0 :(得分:1)
假设ModelDriven
以product
为模型:
<img src="<s:property value='path'/>"/>
<%-- You can also use JSP EL --%>
<img src="${path}"/>
如果有一个action属性,请使用普通bean表示法:
<img src="<s:property value='product.path'/>"/>
<img src="${product.path}"/>