JSF 如何将多个 JSP 页面呈现到 1 个单一视图中? [英] How does JSF render more than one JSP pages into 1 single view?

查看:11
本文介绍了JSF 如何将多个 JSP 页面呈现到 1 个单一视图中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,其中 WebContent 文件夹有许多 .jsp 页面,例如 navigation.jsp、primarytabs.jsp 等.

I have an application where the WebContent folder has a number of .jsp pages like navigation.jsp, primarytabs.jsp etc.

navigation.jsp 包含一个垂直菜单,primarytabs.jsp 包含顶部的选项卡,而其他一些 jsp 包含单独的组件.

The navigation.jsp contains a vertical menu and the primarytabs.jsp contains a tab on top, and some other jsps contain individual components.

当我运行应用服务器的应用程序时,它会打开一个欢迎页面,所有这些导航项、选项卡和其他内容都合并到一个视图中,并向我们展示了所有这些组件的良好组合.

When I run the application of the application server, it opens up a welcome page, and all these navigation items, and tabs and others merge into a single view and show us a well formed combination of all these components.

我做了一些关于复合视图"的研究和阅读.但我不确定是否可以调用此复合视图.

I did some studying and read about "composite views". But I wasn't sure if I can call this composite view or not.

您能否告诉我 JSF 如何将所有这些 jsps 组合到一个视图中,以及在代码中的何处找到绑定"以便我可以进行相关更改?

Can you please enlighten me about how JSF combines all these jsps into one view and where to find that "binding" within the code so I can make the relevant changes?

非常感谢.

更多细节:

非常感谢您的回答.我已经浏览了代码并看到了

Thank you very much for the answers. I have gone through the code and have seen

src="<%= request.getContextPath() %> /faces/tabs.jsp 
src="<%= request.getContextPath() %> /faces/navigator.jsp

等等.我假设这些执行与您在上面使用包含标记描述的类似功能?

and so on. I presume these perform the similar function that you have described above with the include tag?

推荐答案

欢迎页面可能如下所示:

You welcome page might look something like this:

Welcome.jsp:

Welcome.jsp:

<jsp:include page="/include/header.jsp" />
<jsp:include page="/include/navigation.jsp" />

<!-- Content of Page -->

<jsp:include page="/include/footer.jsp" />

把 Welcome.jsp 想象成一个冰箱,而 include 就是页面上的磁铁.

Think of Welcome.jsp being a refrigerator and the includes being magnets that are on the page.

如果您想更改 header.jsp 中的某些内容,该内容会在包含它的每个页面上发生更改,从某种意义上说是模板.

If you would like to change something in the header.jsp that would change on every page it is included on, templating in a sense.

这篇关于JSF 如何将多个 JSP 页面呈现到 1 个单一视图中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆