<c:param> Tag

JSP 标准标签库JSP Standard Tag Library

The <c:param> tag is used to specify parameters in the <c:url> tag, and is related to URL encoding.

Inside the <c:param> tag, the name attribute indicates the name of the parameter, and the value attribute indicates the value of the parameter.

Syntax

<c:param name="<string>" value="<string>"/>

Attributes

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

Attribute Description Required Default Value
name The name of the parameter to set in the URL Yes None
value The value of the parameter no Body

Example

If you want to pass parameters to the <c:param> tag, you need to first use the <c:url> tag to create the URL:

Example

<%@ 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>&lt;c:param&gt;Example</h1>
        <c:url var="myURL" value="main.jsp">
                <c:param name="name" value="Example"/>
                <c:param name="url" value="www.example.com"/>
        </c:url>
      <a href="/<c:out value="${myURL}"/>">
Usage&lt;c:param&gt;Send two parameters for the specified URL.</a>
</body>
</html>

Access the above page through a browser, then view the source code, as shown below:


JSP 标准标签库JSP Standard Tag Library

Other Extensions