Mit dem Tag <s: head> werden die HTML-Kopfinformationen wie Codierung, CSS oder JavaScript-Datei ausgegeben. Siehe den folgenden Ausschnitt:
<%@ taglib prefix="s" uri="/struts-tags" %> <html> <head> <s:head/> </head> <body> ..
Assume you are using the default xhtml theme, it will render the output according to the “ template\xhtml\head.ftl ” file
<html> <Kopf> <link rel = "stylesheet" href = "/ihr__projekt/struts/xhtml/styles.css" type = "text/css"/> <script src = "/your__project/struts/utils.js" type = "text/javascript"> </script> </head> <Körper> ..
Um Ihre neue Js- oder CSS-Datei einzubinden, fügen Sie sie einfach der Vorlagendatei „ template \ xhtml \ head.ftl “ hinzu und geben Sie sie über das Tag <s: head> aus.
Tatsächlich muss dieses <s: head> - Tag nicht durch HTML <head> -Tag gesetzt und verzogen werden, z
<head> <s:head/> </head>
Sie können es an beliebiger Stelle einfügen, es gibt nur den Pfad der CSS- und js-Datei aus (Standardeinstellung im xhtml-Design).
<head> </head> <body> <s:head/> ...
To improve the website performance, the good practice is always put CSS file on top of the page; while the js file on bottom of the page. So, the <s:head> tag may not suitable, a good practice should be create new tag to output the CSS and js file separately, e.g <s:css> and <s:javascript> .