What is the use of tag in JSP?

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

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


The <c:param> tag has the following attributes −

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


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

<c:url value = "/index.jsp" var = "myURL">
   <c:param name = "trackingId" value = "1234"/>
   <c:param name = "reportType" value = "summary"/>
<c:import url = "${myURL}"/>

The above request will pass the URL as below - Try it yourself.

Samual Sam
Samual Sam

Learning faster. Every day.