Read Only Property On View Model in Spring MVC View
How do you access a read only property on a view model in Spring MVC view?
<开发者_JAVA百科;img id="avatar" src="<c:url value="${model.getSquareImage}" />" />
public ImageModel getSquareImage() {
if(getImages() != null && getImages().size() > 0)
return getImages().get(0);
return null;
}
By using ${model.squareImage}
, not ${model.getSquareImage}
. This is standard JSP/JavaBean stuff, and nothing to do with Spring or read-only properties.
精彩评论