JSTL Core tag - param() : Function

The <c:param> tag allows proper URL request parameter to be specified with URL and it does any necessary URL encoding required.

Within a <c:param> tag, the name attribute indicates the parameter name, and the value attribute indicates the parameter value:

Attribute:

The <c:param> tag has following attributes:

AttributeDescriptionRequiredDefault
nameName of the request parameter to set in the URLYesNone
valueValue of the request parameter to set in the URLNoBody

JSTL Example :

If you need to pass parameters to a <c:import> tag, use the <c:url> tag to create the URL first as shown below:

index.jsp

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<title>JSTL Tag Example</title>
</head>
<body>
<c:url value="output.jsp" var="generatedURL">
   <c:param name="name" value="Programming Tutorials"/>
   <c:param name="url" value="www.c4learn.com"/>
</c:url>
<c:import url="${generatedURL}"/>
</body>
</html>

output.jsp

Website Name : <%= request.getParameter("name")%><br />
URL : <%= request.getParameter("url")%>

Output :

It would call following url -

"output.jsp?trackingId=1234;reportType=summary"

Output produced on the output.jsp will be -

Website Name : Programming Tutorials
URL : www.c4learn.com