2
我有兩個JSP文件在java webapp上的同一文件夾中。我們稱它們爲index.jsp和myInclude.jsp。我想在index.jsp中包含myInclude.jsp。 webapp不在ROOT uri中服務,而是在單獨的webapp(例如/ adminWebapp /)之外。Struts 2包含標記
在index.jsp中,我有以下幾點:
<s:include value="myInclude.jsp" />
當我嘗試訪問的index.jsp,Struts的拋出以下異常:
Exception thrown during include of myInclude.jsp
java.io.FileNotFoundException: /myInclude.jsp
麻煩的是,在Struts 2名的include標記在包含文件的URL前添加了「/」。如果Struts 2想要使用絕對路徑(而不是相對路徑),則需要調用/adminWebapp/myInclude.jsp。有什麼可以修復s:include標籤的選項嗎?我希望避免將/ adminWebapp硬編碼到鏈接中,以防萬一我們移動webapp。