<C: url> tag
<C: url> tag will be formatted as a URL string, and then stored in a variable.
This tag will automatically when needed rewrite URL.
var attribute is used to store formatted URL.
<C: url> tag is used to call response.encodeURL () a method of alternative methods. Its real strength lies in the proper URL encoding, comprising: parameter <c param> specified.
Syntax
<c:url var="<string>" scope="<string>" value="<string>" context="<string>"/>
Attributes
<C: url> tag has the following attributes:
Attributes | description | If necessary | Defaults |
---|---|---|---|
value | Based URL | Yes | no |
context | The name of the local network applications | no | Current application |
var | Representative of the variable name URL | no | Print to page |
scope | Scope var attribute | no | Page |
Examples Demo
<%@ 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:url 标签实例</title> </head> <body> <h1><c:url>实例 Demo</h1> <a href="<c:url value="http://www.w3big.com"/>"> 这个链接通过 <c:url> 标签生成。 </a> </body> </html>
Accessed through a browser over the page, and then view the source code appear as follows: