suppose I have an inline styling such as below inside a .JSP file:
假设我在.JSP文件中有如下所示的内联样式:
<style>
.bg{
background-color: <%=application.getAttribute("bgcolor").toString()%>
}
</style>
What if I want to make it an external .CSS file instead of using inline styling? I tested it and it doesn't work properly?
如果我想将其设为外部.CSS文件而不是使用内联样式,该怎么办?我测试了它,它不能正常工作?
Many thanks!
1 个解决方案
#1
2
The .jsp
files are compiled by the container, so you have to write the you css class in .jsp
file make sure the response content type is text/css
and add the JSP file to your html like below.
.jsp文件由容器编译,因此您必须在.jsp文件中编写您的css类,确保响应内容类型为text / css,并将JSP文件添加到您的html中,如下所示。
<link rel="stylesheet" href="filename.jsp">
#1
2
The .jsp
files are compiled by the container, so you have to write the you css class in .jsp
file make sure the response content type is text/css
and add the JSP file to your html like below.
.jsp文件由容器编译,因此您必须在.jsp文件中编写您的css类,确保响应内容类型为text / css,并将JSP文件添加到您的html中,如下所示。
<link rel="stylesheet" href="filename.jsp">