문제

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

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.

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.

More details:

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:

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

<!-- Content of Page -->

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

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

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.

다른 팁

Read about "Apache Tiles", it may give you some clue for your doubt.

And check about

 <jsp:include page"XXXXX.jsp" />. 

It is another way of doing the same.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top