<%@ 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> <head> <link rel = "stylesheet" href = "/your__project/struts/xhtml/styles.css" type = "text/css"/> <script src = "/your__project/struts/utils.js" type = "text/javascript"> </script> </head> <body> ..
新しいjsまたはcssファイルをインクルードするには、テンプレートファイル " template \ xhtml \ head.ftl "に追加し、 <s:head> タグを使用して出力します。
実際には、この<s:head> ** タグは、HTMLの<head>タグで一番上に置く必要はありません。
<head> <s:head/> </head>
あなたはどこにでも置くことができ、CSSとjsファイルパス(xhtmlテーマのデフォルト)を出力します。
<head> </head> <body> <s:head/> ...
-
Good Practice**
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> .