在 EAR 之间共享 JSP
是否可以在 EAR 之间共享 JSP,类似于我们可以使用 .jar 文件在 EAR 之间共享 Java 文件?
我在 JBoss 上有一个大型 J2EE 应用程序,具有许多不同的 EAR,它们都应该具有相同的页眉、页脚等...我宁愿在需要进行更改时不多次复制和粘贴这些文件。
Is it possible to share JSPs between EARs, similar to the way that we can share Java files between EARs by using .jar files?
I have a large J2EE app on JBoss with many different EARs, and they all should have the same header, footer, etc... I would rather not copy and paste these files a dozen times whenever a change needs to be made.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
标签文件可以打包在 jar 中。
它们是带有“.tag”扩展名的 JSP 文件。它们可以被参数化。
Tag files can be packaged in a jar.
They are JSP files with a ".tag" extension. They can be parameterized.
我从未尝试过,但从逻辑上讲,您可以通过将所有 JSP 放入一个公共文件夹来很好地做到这一点
I have never tried but logically speaking you can very well do it by putting all your JSP's into a common folder
我认为它是访问与您所在的环境不同的 servlet 上下文。类似于
假设 WAR1 中的 JSP 绑定到 /somewhere:
使用 c:import 标记(标准 JSTL 标记)的可选“context”属性引用共享上下文)。默认情况下,c:import 使用它所在的上下文,在 war1 中是 /somewhwere。
可能还有其他方法...也许只是忽略你的耳朵,只是进行完整的 http 请求:
我不确定 c:import 标记上的 context 属性的语法。但我相信这是正确的语法(没有斜杠诗句,可能并不重要)。
I think of it as accessing a different servlet context from the one you are in. Something like
Assuming a JSP in WAR1 bound to /somewhere:
Reference the shared context with the optional 'context' attribute of the c:import tag (Standard JSTL tag). By default c:import uses the context it is in, which in war1 is /somewhwere.
There are probably other ways... Perhaps just ignore your ear and just go with a full http request:
I'm not certain on the syntax of the context attribute on the c:import tag. But I believe that is the correct syntax (with the slash verse without, it might not matter).
使用站点网格。
无需对现有应用程序进行任何更改。使用 sitemesh 发起一场新的战争。它可以动态装饰多个 url 的内容。
http://raibledesigns.com/rd/entry/use_sitemesh_to_decorate_multiple
--Kiran.kumar
Use sitemesh.
There is no need to change anything in the existing application. Create a fresh war with sitemesh. It can decorate content from multiple urls dynamically.
http://raibledesigns.com/rd/entry/use_sitemesh_to_decorate_multiple
--Kiran.kumar