JSF resme link verme kodu kullanımı örneği (JSF put,add link to image code usage example)

JSF resme link verme işlemi için aşağıdaki kod bloğunda olduğu gibi HTML’in “a” elementini yerine “h:outputLink” kullanabilirsiniz, HTML “img” yerine ise “h:graphicImage” kullanabilirsiniz.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head>
	<f:facet name="first">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9" />
		<title>My Image Link Page</title>
	</f:facet>
</h:head>

<h:body>

	<div id="sliderFrame">
		<div id="slider">
			<ui:repeat var="my" value="#{myBean.myList}">
				<h:outputLink value="#{my.link}" rendered="#{my.link != null}">
					<h:graphicImage value="#{my.imgUrl}" alt="#{my.caption}"/>
				</h:outputLink>
				<h:graphicImage value="#{my.imgUrl}"  alt="#{my.caption}" rendered="#{my.link == null}" />
			</ui:repeat>
		</div>
	</div>

</h:body>
</html>
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on StumbleUpon0Share on Reddit0

Leave a Reply


*