jsp 中框架集的替代方案
我在网页的左侧有登录按钮,现在我希望它可以在我网站的任何页面上使用,但是我不想一直重新加载整个页面,当我想保留用户登录时他的名字常量在左侧,适用于所有网站。 我想避免框架集,这对我的网站来说确实有问题。 使用JSP构建的站点id。 有哪些选择。 我想过使用
并尝试动态更改页面 url,但这是不可能的,因为它被编译为 servlet 并且是在服务器端。
另外,如果我在每个页面中包含 leftSide.jsp,则 leftSide 会为每个页面重新加载。 请指教,必须有一个解决方案来解决这个简单且非常常见的问题。
I have login button in the left side of the web page, now I want this to be available at any page in my site, however I don't want to reload the whole page all the time, when the user login I want to keep his name constant on the left side which is there for the all site.
I want to avoid frameset this is realy problematic for my site.
The site id built with JSP.
what are the options.
I thought of using <jsp:include page=''>
and try to change the page url dynamicly but this is impossible since it is compiled to servlet and this it server side.
Also if I include leftSide.jsp in each page than leftSide does reload for every page.
please advice, there must be a solution for this simple and very common problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
<%@ include file="login.jsp" %>
。 login.jsp 可以包含通用代码。对于其中任何一个,如果您不想重新加载,则需要 ajax。也许使用 jQuery。
)
<%@ include file="login.jsp" %>
in all pages. The login.jsp can contain the common codeWith either of these, if you don't want to reload, you need ajax. Perhaps using jQuery.
<div>
) accordingly, with javascript