How to put dynamic href from tag in JSF?

I want to use a tag on my JSF page, but also want to have href dynamic content. I know that in JSF there is h: commandLink, but I do not want to use it for my own purposes. I have t: dataTable elemet that iterates over the results and shows them on my page. Here is the situation:

<t:dataList id="dataTable" value="#{manBean.fullResult}" var="element" first="0" rows="10">
<div class="photos">
<a href="  IN THIS PLACE I WANT DYNAMIC CONTENT "><img src="myimages/IN THIS TOO.../image.jpg"</a>
</div>
...
</t:dataList>

I tried code like this:

<a href="myimages/#element[0]/image.jpg"><img src="myimages/#element[0]/image.jpg"</a>

. #element [0] is an element of the list of results from dataTable and contains values ​​such as: 0,1,2,3 ... etc. it ends with a witch error that I could not use # {...} in the template. What should I do? Does anyone know a good solution for this?

+3
source share
1 answer

JSF JSP, <h:outputLink> <h:graphicImage> <a> <img>.

<h:outputLink value="myimages/#{element}/image.jpg">
    <h:graphicImage value="myimages/#{element}/image.jpg" />
</h:outputLink>

JSF Facelets, EL .

<a href="myimages/#{element}/image.jpg">
    <img src="myimages/#{element}/image.jpg" />
</a>
+2

Source: https://habr.com/ru/post/1776429/


All Articles