English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The <c:param> tag is used to specify parameters in the <c:url> tag and is related to URL encoding.
In the <c:param> tag, the name attribute indicates the parameter name, and the value attribute indicates the parameter value.
<c:param name="<string>" value="<string>"/>
The <c:param> tag has the following attributes:
Attribute | Description | Is it necessary | Default value |
---|---|---|---|
name | The name of the parameter to be set in the URL | yes | none |
value | Parameter Value | No | Body |
If you want to pass parameters to the <c:import> tag, you need to use the <c:url> tag to create the URL first:
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <html> <head> <title>c:forTokens Tag Example</title> </head> <body> <h1<c:param> Example</h1> <c:url var="myURL" value="main.jsp"> <c:param name="name" value="w3codebox"/> <c:param name="url" value="www.oldtoolbag.com"/> </c:url> <a href="/<c:out value="${myURL}"/>"> Use <c:param> to send two parameters to a specified URL.</a> </body> </html>
Access the above page through a browser and then view the source code or press F12 View