自动在每个 JSP 中包含一个 JSP
我想通过透明地包含它们来进一步简化我的 JSP。 例如,这是我要删除的行:
<%@ include file="/jsp/common/include.jsp"%>
include.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>
include-prelude
和 include-coda
都不起作用。
我读到其他 WebSphere 用户无法启动并运行它; 然而,tomcat 用户却可以。
I would like to simplify my JSP's even further by transparently including them. For instance, this is the line I would like to remove:
<%@ include file="/jsp/common/include.jsp"%>
The include.jsp file basically declares all the tag libraries I am using. I am running this on WebSphere 6.0.2 I believe and have already tried this configuration:
<!-- 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>
Both the include-prelude
and include-coda
did not work.
I was reading that other WebSphere users were not able to get this up and running; however, tomcat users were able to.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以尝试编写一个调用的过滤器
You could try writing a Filter that calls
我不确定这是哪个版本的 Servlet 规范引入的...Websphere 的 servlet 容器是否可能不支持它?
不管怎样,对于此类任务,有一个更好的第三方工具,称为 SiteMesh。 它允许您完全按照您所描述的方式撰写页面,但方式非常灵活。 受到推崇的。
I'm not sure which version of the Servlet spec this was introduced... is it possible that Websphere's servlet container doesn't support it?
Either way, for this sort of task there's a much nicer 3rd-party tool called SiteMesh. It allows you to compose pages in exactly the sort of way you describe, but in a very flexible way. Recommended.
jsp-property-group
是在 JSP 2.0 (iow Servlet 2.4) 中引入的。 Websphere 6.0 是 Servlet 2.3。所以你有3个选择:
The
jsp-property-group
was introduced in JSP 2.0 (i.o.w. Servlet 2.4). Websphere 6.0 is Servlet 2.3.So you have 3 options: