Java 将JSTL转换为CSS文件

Java 将JSTL转换为CSS文件,java,html,css,jsp,Java,Html,Css,Jsp,我有三个问题: 模板\u blank.jsp 模板\u connected.jsp template.jsp 此jsp调用css文件-->common.css 这是template.jsp中的调用,例如: <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%&g

我有三个问题:

  • 模板\u blank.jsp
  • 模板\u connected.jsp
  • template.jsp
此jsp调用css文件-->common.css

这是template.jsp中的调用,例如:

<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html:base ref="site"/>
<html:html>
    <head>
        <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <tiles:useAttribute id="title" name="title"/>
        <title><bean:message key="${title}"/></title>   
        <link rel="stylesheet" type="text/css" href="<html:rewrite page="/css/commun.css"/>">
        <link rel="icon" type="image/png" href="images/icone.ico" />
        <script type="text/javascript" src="<html:rewrite page="/javascript/commun.js" />" ></script>
        <!-- Start of user code for header -->
        <jsp:include page="/javascript/generic/messages.jsp"/> 
        <!-- End of user code for header -->
    </head>
    <body>
....

....
这是我的common.css

/* Start of user code for commun.css */
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<c:set var="headerHeight" value="156" />
<c:set var="footerHeight" value="0" /> /* 95 */
<c:set var="menuWidth" value="180" />
<c:if test="${height == null}">
    <c:set var="height" value="500" />
</c:if>
<c:if test="${width == null}">
    <c:set var="width" value="500" />
</c:if>
<c:set var="contentHeight" value="${height - footerHeight - headerHeight}" />
<c:set var="contentWidth" value="${width}" />
<c:set var="contentWidthConnected" value="${width - menuWidth}" />
<c:set var="tabHeight" value="27" />
<c:set var="contentHeightWithTab" value="${contentHeight - tabHeight - 1}" />

div#errors UL {
    background-color: yellow;
    color: red;
    border: 1px dotted red;
    padding: 5px;
    padding-left: 20px;
    margin-left: 20px;
    margin-right: 20px;
    font-size: 10px;
}

.fontAlerte {
    color: #006039;
    font-size: 11px;
}

.field_error {
    background-color: yellow;
    border: 1px dotted red;
}
....
/*common.css用户代码的开始*/
/* 95 */
分区#错误UL{
背景颜色:黄色;
颜色:红色;
边框:1px点红色;
填充物:5px;
左侧填充:20px;
左边距:20px;
右边距:20px;
字体大小:10px;
}
Fontalte先生{
颜色:#006039;
字体大小:11px;
}
.field_错误{
背景颜色:黄色;
边框:1px点红色;
}
....
您可以在mycss中看到JSTL。它用于定义不同的
高度
宽度
。 问题在于css是在html显示之后执行的


所以我有一个显示问题,每次调用新页面时都会产生闪烁效果。有可能改善这种行为吗?

您的订单似乎已关闭。我不清楚什么是JSP,什么是JS内容,但我只想说,您应该尽可能地延迟JS加载(即,等到标记结束之前)



了解css预处理器。如果没有时间,请将样式表内容移动到jsp页面内,而不是将其作为外部样式sheet@BalajiKrishnan我将所有css复制到
<代码>还是仅jstl代码?只需将整个css内容放入head样式中即可tag@BalajiKrishnan它稍微好一点,但是css太大了,我不能把它放在我的JSP中。不仅如此,你失去了外部化。对于单个css更改,您可能必须编辑每个jsp文件中的样式。为什么要在css中使用jstl?