Display element in JSP only if model element not null


Octocat **Promotion** - Efficiently manage your coding bookmarks, aka #codingmarks, on www.codingmarks.org and share your hidden gems with the world. They are published weekly on Github. You can help us build THE programming-resources location - Star


How to display element in JSP only if model element not null

To do that you can use the or _ tags to make conditional rendering in Java Server Pages (JSP) using the JSP Standard Tag Library (JSTL) like in the following code snippet:

<div>
	<c:if test="${not empty podcast.twitterPage}">
		<a href="${podcast.twitterPage}" target="_blank" class="icon-twitter-producer producer-social"></a>
	</c:if> 			 		
	<c:if test="${not empty podcast.fbPage}">
		<a href="${podcast.fbPage}" target="_blank" class="icon-facebook-producer producer-social"></a>
	</c:if> 			 		
	<c:if test="${not empty podcast.gplusPage}">
		<a href="${podcast.gplusPage}" target="_blank" class="icon-google-plus-producer producer-social"></a>
	</c:if> 
</div>

Podcastpedia.org on GitHub

New codingmarks published in week 48 of 2018

New codingmarks published in week 48 of 2018. Keywords: android, angular, api, documentation, feign, graphql, http, http-client, http2, https, java, kotlin, mapper, mapping, odata, rest, rest-client, spring, spring-boot and swagger Continue reading

New codingmarks published in week 46 of 2018

Published on November 20, 2018

New codingmarks published in week 45of 2018

Published on November 13, 2018