October 29
Il tag di ancoraggio è uno dei tag HTML più comunemente utilizzati; è spesso chiamato un "collegamento ipertestuale" o "collegamento". Il simbolo HTML "<a>" rappresenta il tag di ancoraggio. Essa ha due usi principali --- per la produzione di un collegamento a un altro documento utilizzando l'attributo href e per fare un segnalibro all'interno di un documento utilizzando l'attributo name. Poiché il tag di ancoraggio è un elemento HTML, può anche essere applicato a JavaServer Pages o JSP.
1 Utilizzare il codice qui sotto per applicare un collegamento ipertestuale tipico o tag di ancoraggio per i documenti Web in un ambiente HTML:
<A href = "main_destination.html"
href1="embedded_destination1.html" text1="embedded hypertext1"
href2 = text2 "embedded_destination2.html" = "hypertext2 embedded"
href3 = text3 "embedded_destination3.html" = "hypertext3 embedded"
href4 = "embedded_destination4.html" text4 = "hypertext4 embedded"> ipertestuale principale
</a>
2 Applicare il seguente codice per creare una versione annidato di tag di ancoraggio per i documenti Web in un ambiente HTML:
<a href="main_destination.html"> ipertesto principale
<a href="embedded_destination1.html">embedded hypertext1</a>
& Lt; a href = "embedded_destination2.html"> Embedded hypertext2 & lt; / a>
& Lt; a href = "embedded_destination3.html"> Embedded hypertext3 & lt; / a>
& Lt; a href = "embedded_destination4.html"> Embedded hypertext4 & lt; / a>
</a>
3 Utilizzare il codice seguente per creare tag di ancoraggio in una pagina JSP:
<Tag>
<name>multi</name>
& Lt; tagclass> util.tags.MultiLinkTag & lt; / tagclass>
& Lt; bodycontent> tagdependent & lt; / bodycontent>
& Lt; attributo>
& Lt; nome> ID & lt; / nome>
& Lt; richiesto> true & lt; / richiesta>
& Lt; / attribute>
& Lt; attributo>
& Lt; nome> href & lt; / nome>
& Lt; richiesto> true & lt; / richiesta>
& Lt; / attribute>
& Lt; attributo>
& Lt; nome> Testo & lt; / nome>
& Lt; richiesto> true & lt; / richiesta>
& Lt; / attribute>
& Lt; attributo>
& Lt; nome> Metalink & lt; / nome>
& Lt; richiesto> true & lt; / richiesta>
& Lt; / attribute>
& Lt; attributo>
& Lt; nome> onmouseover & lt; / nome>
& Lt; richiesto> false & lt; / richiesta>
& Lt; / attribute>
</ Tag>
Il nome del tag è "multi", ed è gestito utilizzando la classe Java "util.tags.MultiLinkTag." Questa classe è indicato come gestore tag. JSP richiede questo tag handler per gestire una interfaccia dettagliato tra più file.
4 Compilare il codice per testare ed eseguire sul proprio browser.