0
我有點新鮮JSP,我有問題的理解可能是錯誤有以下包括我的JSP中的代碼:包括來自另一個JSP文件JSP代碼正確
../test-project/main。 JSP
<jsp:include page="../blueprint-project/header-includes.jsp"/>
<!-- More HTML/CSS code below which is working and not blocking -->
../blueprint-project/header-include.jsp
<%@ taglib uri="struts-sslext" prefix="sslext" %>
<%@ page import="mts.psp.web.struts.util.WebSessionUtil" %>
<%@ page import="mts.psp.web.struts.util.ActionUtil" %>
<%@ page import="mts.psp.metrics.entity.TestGroup" %>
<%@ page import="mts.psp.util.common.ConfigUtil" %>
<%@ taglib uri="struts-tiles" prefix="tiles" %>
<%@ taglib uri="struts-html" prefix="html" %>
<%@ taglib uri="struts-logic" prefix="logic" %>
<%@ taglib uri="struts-bean" prefix="bean" %>
<%@ taglib uri="jstl-core" prefix="c" %>
在頁面的頂部main.jsp中內的先前存在於報頭include.jsp的代碼。我試圖做的是把這段代碼放在另一個.jsp文件(名爲header-include.jsp)中,並將它動態地包含在main.jsp中。當我嘗試這樣做時,我得到一個500錯誤。我試圖做到可能/正確嗎?任何來自社區的幫助都會非常出色。
不,它不能用** dynamic ** include完成,它在運行時解析。 JSP編譯器如何理解,如果在運行時動態地包含這些taglib,那麼它們會如何? – 2015-02-23 18:25:00
這是非常有用的,有沒有什麼方法可以完成你所知道的事情,或者可能是我想這樣做的最好方式,最好是保持原來的代碼? – AGE 2015-02-23 18:34:09
使用** static ** include。 http://stackoverflow.com/questions/14580120/whats-the-difference-between-including-files-with-jsp-include-directive-jsp-in。也就是說,我在IDE中遇到了不好的經歷,因爲它無法理解JSP標籤,提供自動完成等。 – 2015-02-23 18:36:09