当包含的文件很大时,似乎会有开销。这与文件的内容无关,仅与文件的大小有关,文件仅与注释文本无关

<tiles:insertTemplate template="/WEB-INF/very/large/file/with/nothing/but/comments.jsp">
</tiles:insertTemplate>


insertTemplate的时间与文件的大小成正比。

comments.jsp看起来像这样:


nt comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment comment--%>
<%--comment comment comment comment comment comment comment comment comment comment comment comment comment


评论-%>

最佳答案

我在Tomcat(版本7)中遇到了同样的问题。我解决了将web.xml中的development参数设置为false的问题。

<servlet>
        <servlet-name>jsp</servlet-name>
        <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
        <init-param>
            <param-name>development</param-name>
            <param-value>false</param-value>
        </init-param>
...
</servlet>

关于java - <tiles:insertTemplate>很慢,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/3841399/

10-12 01:21