Easy Tutorial
❮ Jsp Http Status Codes Jsp Auto Refresh ❯

<c:param> Tag

JSP Standard Tag Library

The <c:param> tag is used to specify parameters within the <c:url> tag, and it 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

&lt;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 be set in the URL Yes None
value The value of the parameter No Body

Example

To pass parameters to the <c:param> tag, you need to first create a URL using the <c:url> tag:

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>
        &lt;c:url var="myURL" value="main.jsp">
                &lt;c:param name="name" value="tutorialpro"/>
                &lt;c:param name="url" value="www.tutorialpro.org"/>
        </c:url>
      <a href="/<c:out value="${myURL}"/>">
  Use &lt;c:param&gt; to send two parameters to the specified URL.</a>
</body>
</html>

When accessing the above page through a browser and viewing the source code, it displays as follows:


JSP Standard Tag Library

❮ Jsp Http Status Codes Jsp Auto Refresh ❯