The JSTL url tag is just an alternative method of writing the call to the response.encodeURL() method. The only real advantage the url tag provides is proper URL encoding, including any parameters specified by children param tag.
JSTL <C:URL> Tag Example:
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <html> <head> <title>JSTL URL Tag Example</title> </head> <body> <c:url value="https://www.dineshonjava.com" var="tutorialLink"> <c:param name="author" value="Dinesh"></c:param> </c:url> <c:import url="${tutorialLink}"></c:import> </body> </html>
As you can see above, <c:url> tag is being used to store the value of url in a variable tutorialLink.
In <c:import> tag, the url attribute will have following value.
https://www.dineshonjava.com?author=Dinesh
Attributes of <c:url> tag are:
1. value:This attribute provides URL to be processed.
2. var: This attribute provides name of the exported scoped variable for the processed url. The type of the scoped variable is String.
3. context: This attribute provides name of the context when specifying a relative URL resource that belongs to a foreign context.
4. scope: This attribute provides the scope for var.
Strategy Design Patterns We can easily create a strategy design pattern using lambda. To implement…
Decorator Pattern A decorator pattern allows a user to add new functionality to an existing…
Delegating pattern In software engineering, the delegation pattern is an object-oriented design pattern that allows…
Technology has emerged a lot in the last decade, and now we have artificial intelligence;…
Managing a database is becoming increasingly complex now due to the vast amount of data…
Overview In this article, we will explore Spring Scheduler how we could use it by…