【发布时间】:2026-01-09 08:35:01
【问题描述】:
我刚刚创建了一个新的 IceFaces 应用程序,我正在尝试在所有页面中包含一个导航栏。当我使用 jsp:directive.include 标记时,该文件被包含在内,但是当我使用 jsp:include 时,它似乎没有被加载。事实上,当我在浏览器中查看 HTML 源代码时,就像包含的文件完全是空的一样。我不想使用jsp:directive.include,因为它不会自动显示包含文件的任何更新。
我的环境:Eclipse 3.5、Tomcat 6、JSF 1.2、IceFaces 1.8。
重现问题的步骤和代码片段:
使用以下选项创建一个新的动态 Web 项目: 目标运行时:Apache tomcat v6.0 动态网页模块版本:2.5 配置:ICEfaces 项目
-
创建一个新的ICEFaces JSPX 文件——主文件。一些代码:
<jsp:directive.page contentType="text/html;charset=ISO-8859-1" /> <f:view > <ice:outputDeclaration doctypeRoot="HTML" doctypePublic="-//W3C//DTD HTML 4.01 Transitional//EN" doctypeSystem="http://www.w3.org/TR/html4/loose.dtd" /> <html> <head> <title>test file</title> <link rel="stylesheet" type="text/css" href="./xmlhttp/css/rime/rime.css" /> </head> <body> <jsp:directive.include file="./vertical_navigation.jsp" /> <!-- working --> <jsp:include page="./vertical_navigation.jsp" /> <!-- not working, no error though --> </body> </html> </f:view> -
创建要包含的文件,也可以作为新的ICEFaces JSPX 文件。简化代码:
<ice:form> <ice:panelGrid columns="1" width="152"> <ice:graphicImage url="./img/image.jpg"></ice:graphicImage> <ice:panelCollapsible expanded="true"> <f:facet name="header"> <ice:panelGroup> <ice:outputText value="Customer"/> </ice:panelGroup> </f:facet> <ice:panelGrid columns="1"> <ice:commandLink action="customer"><ice:outputText value="Customer name" /></ice:commandLink> </ice:panelGrid> </ice:panelCollapsible> </ice:panelGrid> </ice:form> </body> </html> </f:view>
一些备注:
- 我是 JSF 的新手,如有明显错误请见谅。
- 在主文件(第一个)中我没有同时使用两个标签。我将两者都粘贴在这里只是为了表明我正在尝试这两个选项。
- 我将这两个文件都创建为“ICEFaces JSPX 文件”,但第二个文件的扩展名为 .jsp。
- 当我使用
directive.include标签时,会加载包含的文件。但如果我更改它,它不会自动重新发布。
【问题讨论】:
标签: eclipse jsp jsf tomcat icefaces