Reputation: 2827
how I can insert the value of image in the tag div?
<f:verbatim>
<div style="background: #000 #{item.image} no-repeat 0 0
backround-size:cover;height:90px;width:160px">
</div>
</f:verbatim>
n this way it doesn't work.
Upvotes: 0
Views: 336
Reputation: 1109532
The presence of <f:verbatim>
indicates that you're using jurassic JSP instead of its successor Facelets. Both JSP and <f:verbatim>
are deprecated since JSF 2.0 (in 2009 already). The <f:verbatim>
has no utter value in Facelets.
EL in template text like as in your attempt is not supported in JSP. It's only supported in Facelets. In JSP, EL is only evaluated in attributes of a JSP tag. So, you need a real JSF component instead of a plain HTML <div>
which is basically "template text".
To let JSF generate a <div>
element, use <h:panelGroup layout="block">
.
<h:panelGroup layout="block" style="background: #000 #{item.image} no-repeat 0 0
backround-size:cover;height:90px;width:160px">
</h:panelGroup>
In case you're actually using JSF 2.x on Facelets, but got mixed up with JSF 1.x practices because you've only read prehistoric books/resources targeted on JSF 1.0/1.1, where <f:verbatim>
is demonstrated in such way, then simply get rid of <f:verbatim>
tag and throw away those ancient resources and remember to pay attention to JSF version mentioned in those resources. It must be at least JSF 2.0.
Unrelated to the concrete problem, you've a typo in your inline CSS.
Upvotes: 1