Java 在每个JSP中自动包含一个JSP
我希望通过透明地包含JSP来进一步简化JSP。例如,这是我要删除的行:Java 在每个JSP中自动包含一个JSP,java,jsp,websphere,Java,Jsp,Websphere,我希望通过透明地包含JSP来进一步简化JSP。例如,这是我要删除的行: <%@ include file="/jsp/common/include.jsp"%> jsp文件基本上声明了我正在使用的所有标记库。我相信我正在WebSphere 6.0.2上运行此配置,并且已经尝试过此配置: <!-- Include this for every JSP page so we can strip an extra line from the JSP -->
<%@ include file="/jsp/common/include.jsp"%>
jsp文件基本上声明了我正在使用的所有标记库。我相信我正在WebSphere 6.0.2上运行此配置,并且已经尝试过此配置:
<!-- Include this for every JSP page so we can strip an extra line from the JSP -->
<jsp-config>
<jsp-property-group>
<url-pattern>*.htm</url-pattern>
<!--<include-prelude>/jsp/common/include.jsp</include-prelude>-->
<include-coda>/jsp/common/include.jsp</include-coda>
</jsp-property-group>
</jsp-config>
*.htm
/jsp/common/include.jsp
include prelude
和include coda
都不起作用
我读到其他WebSphere用户无法启动并运行它;但是,tomcat用户能够。我不确定引入了哪个版本的Servlet规范。。。Websphere的servlet容器是否可能不支持它
无论如何,对于这类任务,有一个更好的第三方工具叫做。它允许您完全按照您描述的方式撰写页面,但方式非常灵活。推荐使用。您可以尝试编写一个筛选器,用于调用
getRequestDispatch( "path-to-jsp-to-include" ).include( req, res )
jsp2.0(i.o.w.Servlet 2.4)中引入了
jsp属性组。WebSphere6.0是Servlet2.3
因此,您有3种选择:
算了吧
升级Websphere
替换Websphere
我支持这个。SiteMesh或Tiles。我以前使用过SiteMesh,我很喜欢它;然而,我们使用的是瓷砖。我只是想简化JSP,使它的代码行更少,分条到有意义的部分。我们可能正在升级websphere,但我们永远不会替换它,原因与当初选择开发它的原因相同。在我开始使用WID/WAS之前,我一直喜欢IBM产品。