<C: param> tag
Previous: <c: forEach>, < c: forTokens> tag
<C: param> tag is used in the <c: url> tag to specify parameters, but also related to the URL encoding.
In: within <c param> tag, name attribute indicates the name of the parameter, value attribute indicates the value of the parameter.
Syntax
<c:param name="<string>" value="<string>"/>
Attributes
<C: param> tag has the following attributes:
Attributes | description | If necessary | Defaults |
---|---|---|---|
name | Name URL parameters to be set | Yes | no |
value | Value of the parameter | no | Body |
Program Example
If you want to <c: import> tag to pass parameters, you need to use <c: url> tag to create URL:
<%@ 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 标签实例</title> </head> <body> <h1><c:param> 实例</h1> <c:url var="myURL" value="main.jsp"> <c:param name="name" value="w3big"/> <c:param name="url" value="www.w3big.com"/> </c:url> <a href="/<c:out value="${myURL}"/>"> 使用 <c:param> 为指定URL发送两个参数。</a> </body> </html>
Accessed through a browser over the page, and then view the source code appear as follows:
Previous: <c: forEach>, < c: forTokens> tag