2
我在Struts2項目文件夾中有一個圖像images/example.jpg
。如何在struts2中動態設置url標籤的「value」屬性?
我能夠通過顯示此圖像:
<s:url value="/images/example.jpg" var="urlTag"></s:url>
<img src="<s:property value="#urlTag"/>" height="200" width="200"/>
但是如何設置URL-值動態屬性? 我試着這樣做:
<s:url value="<s:property value="imageLink"/>" var="urlTag"></s:url>
/* where "imgageLink" has the value(/images/example.jpg) obtained from the action class*/
<img src="<s:property value="#urlTag"/>" height="200" width="200"/>
上面的代碼提供了一個錯誤:
org.apache.jasper.JasperException: /display.jsp (line: 28, column: 45) equal symbol expected
(即在上面的代碼imageLink
之前)
請提出這方面的任何解決方案。
注意:我已經使用inputstream
成功完成圖像傳輸,但我寧願使用Struts url
標記來解決這個問題。
你在哪裏設置imageLink變量?您是否嘗試過使用s:url值屬性的#imageLink。 –