JSTL Core c:url Tag

The JavaServer Pages Standard Tag Library (JSTL) encapsulates core functionality common to many JSP applications. Instead of mixing tags from numerous vendors in your JSP applications, JSTL allows you to employ a single, standard set of tags. This standardization allows you to deploy your applications on any JSP container supporting JSTL and makes it more likely that the implementation of the tags is optimized.

Below is the syntax to include JSTL Core library in your JSP for JSTL Core c:url Tag :

<%@ taglib prefix=”c” uri=”http://java.sun.com/jsp/jstl/core” %>

JSTL Core c:url Tag :Sets the result of an expression evaluation in a ‘scope’.The syntax and attributes are as follows with example and ran on server to show you output:

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<title>c:url Example</title>
</head>
<body>
<body>

<a href="<c:url value="/cout.jsp"/>">Java Honk Test</a>

</body>
</html>

 

JSTL Core c:url Tag : Once you run example you will see below output with link and if click it will redirect you configured url page:

curl

Once you click above link you will see below page:

curl2

Leave a Reply

Your email address will not be published. Required fields are marked *