最佳答案
是的。这绝对是可能的。 Here is a tutorial on JSP templates .它向您介绍了 include 指令,它允许您包含静态内容,例如 HTML 文件,例如:
<%@include file='header.html'%>
或允许您包含模板的模板标签库
<%@ taglib uri='/WEB-INF/tlds/template.tld' prefix='template' %>
<html><head><title><template:get name='title'/></title></head>
<body background='graphics/background.jpg'>
<table>
<tr valign='top'><td><template:get name='sidebar'/></td>
<td><table>
<tr><td><template:get name='header'/></td></tr>
<tr><td><template:get name='content'/></td></tr>
<tr><td><template:get name='footer'/></td></tr>
</table>
</td>
</tr>
</table>
</body></html>
您完全可以从模板或原始 JSP 文件中引用 CSS。这很简单。您在 JSP 中的 HTML 标记中引用 CSS 的方式与您通常采用的方式相同:
<link rel="stylesheet" href="common.css" type="text/css">
有关详细信息,请参阅 W3 .
关于css - 是否可以在我的 jsp 中实现像这样的 css 模板?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5585806/