Latest web development tutorials

<C: url> tag

JSP standard Tag Library JSP standard Tag Library

<C: url> balise sera formaté comme une chaîne d'URL, puis stockée dans une variable.

Cette balise sera automatiquement si nécessaire réécriture URL.

attribut var est utilisé pour stocker l'URL formatée.

<C: url> est utilisé pour appeler response.encodeURL () une méthode de méthodes alternatives. Sa véritable force réside dans le codage URL correcte, comprenant: paramètre <c param> spécifié.

syntaxe

<c:url
  var="<string>"
  scope="<string>"
  value="<string>"
  context="<string>"/>

propriété

<C: url> balise a les attributs suivants:

propriété description le cas échéant Par défaut
valeur URL Basé il est aucun
contexte Le nom des applications de réseau local aucun Application actuelle
var Représentant du nom de la variable URL aucun Imprimer la page
portée attribut var Scope aucun page

Exemples Démo

<%@ 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>&lt;c:url&gt实例 Demo</h1>
	<a href="<c:url value="http://www.w3big.com"/>">
	 这个链接通过 &lt;c:url&gt; 标签生成。
	</a>
</body>
</html>

Accessibles par un navigateur sur la page, puis afficher le code source apparaître comme suit:


JSP standard Tag Library JSP standard Tag Library