在iFrame中显示html/JSP文档

在iFrame中显示html/JSP文档,html,css,jsp,iframe,navigation,Html,Css,Jsp,Iframe,Navigation,我正忙着开发一个web应用程序,它基本上有5个页面,人们可以从导航栏跳转到其中(显然)。但是,我想把所有内容都保存在我的“index.html”中,而不是像通常那样使用链接,在那里你会被直接指向一个完全不同的网页。因此,当您单击其中一个导航栏链接时,iFrame将填充不同的文档,例如about.html、controlpanel.html、profile.html等 这是一个好的做法还是有更好的方法 提前谢谢 我看到的一个问题是,您的用户将无法为您的页面添加书签/共享任何链接 他们所能做的就是使

我正忙着开发一个web应用程序,它基本上有5个页面,人们可以从导航栏跳转到其中(显然)。但是,我想把所有内容都保存在我的“index.html”中,而不是像通常那样使用链接,在那里你会被直接指向一个完全不同的网页。因此,当您单击其中一个导航栏链接时,iFrame将填充不同的文档,例如about.html、controlpanel.html、profile.html等

这是一个好的做法还是有更好的方法


提前谢谢

我看到的一个问题是,您的用户将无法为您的页面添加书签/共享任何链接

他们所能做的就是使用
/index.html

编辑: 根据您的评论,为了避免编码页眉/页脚时出现冗余,我建议:

init.jsp

Declare all imports, taglibs, any global variables here.
<%@ include file="init.jsp" %>
Write code for header here
<%@ include file="init.jsp" %>
Write code for footer here
<%@ include file="init.jsp" %>
<%@ include file="header.jsp" %>
Write main code here.
<%@ include file="footer.jsp" %>
<%@ include file="init.jsp" %>
<%@ include file="header.jsp" %>
Write main code here.
<%@ include file="footer.jsp" %>
header.jsp

Declare all imports, taglibs, any global variables here.
<%@ include file="init.jsp" %>
Write code for header here
<%@ include file="init.jsp" %>
Write code for footer here
<%@ include file="init.jsp" %>
<%@ include file="header.jsp" %>
Write main code here.
<%@ include file="footer.jsp" %>
<%@ include file="init.jsp" %>
<%@ include file="header.jsp" %>
Write main code here.
<%@ include file="footer.jsp" %>

在这里为标题编写代码
footer.jsp

Declare all imports, taglibs, any global variables here.
<%@ include file="init.jsp" %>
Write code for header here
<%@ include file="init.jsp" %>
Write code for footer here
<%@ include file="init.jsp" %>
<%@ include file="header.jsp" %>
Write main code here.
<%@ include file="footer.jsp" %>
<%@ include file="init.jsp" %>
<%@ include file="header.jsp" %>
Write main code here.
<%@ include file="footer.jsp" %>

在这里为页脚编写代码
page1.jsp

Declare all imports, taglibs, any global variables here.
<%@ include file="init.jsp" %>
Write code for header here
<%@ include file="init.jsp" %>
Write code for footer here
<%@ include file="init.jsp" %>
<%@ include file="header.jsp" %>
Write main code here.
<%@ include file="footer.jsp" %>
<%@ include file="init.jsp" %>
<%@ include file="header.jsp" %>
Write main code here.
<%@ include file="footer.jsp" %>

在这里编写主代码。
page2.jsp

Declare all imports, taglibs, any global variables here.
<%@ include file="init.jsp" %>
Write code for header here
<%@ include file="init.jsp" %>
Write code for footer here
<%@ include file="init.jsp" %>
<%@ include file="header.jsp" %>
Write main code here.
<%@ include file="footer.jsp" %>
<%@ include file="init.jsp" %>
<%@ include file="header.jsp" %>
Write main code here.
<%@ include file="footer.jsp" %>

在这里编写主代码。

没错,我没想到。。这是一个相当小的应用程序,因此没有必要为特定页面添加书签。但是有些人想我想。。。我想做的全部事情就是这样,这样我就可以避免在每页的整个过程中都要对“页眉”和“页脚”部分进行编码。。同时避免每次导航点击时加载整个页面。您可以始终使用包含文件
,以避免代码冗余。我想现在这是排序,你可以忘记iframe解决方案:)这就是为什么我喜欢这个网站:-)谢谢大家!