开发者

getting path value from bean using struts2

开发者 https://www.devze.com 2023-04-13 07:17 出处:网络
public class product { privat开发者_JAVA技巧e String name; private String path; // and getter setter of attributes
public class product {
    privat开发者_JAVA技巧e String name;
    private String path;
    // and getter setter of attributes
}

I want to get the path value from the bean and give this path value in "img src" tag. I know that print the path attribute value but my question is that use this path value in img tag to upload this image


Assuming ModelDriven with a product as the model:

<img src="<s:property value='path'/>"/> 
<%-- You can also use JSP EL --%>
<img src="${path}"/>

If there's an action property instead, use normal bean notation:

<img src="<s:property value='product.path'/>"/> 
<img src="${product.path}"/>
0

精彩评论

暂无评论...
验证码 换一张
取 消