我做了一个网站,所有页面的头部都用的一个文件,用c:import引进来,头部有登陆和退出,当登陆成功后,显示退出,当退出后显示登录,另外还有单独的登录页面,当登陆成功后进入首页,首页的头部应该显示某某登录成功和退出按钮。
但是当进入别的页面后,只有刷新以后才会显示登录状态。退出后,只有刷新后,别的页面才显示退出状态,请问怎么回事啊,我用过HttpServletResponse response = runData.getResponse();
2. response.setHeader("Pragma","No-cache");
3. response.setHeader("Cache-Control","no-cache");
4. response.setDateHeader("Expires", 0);
不管用。请问还有别的方法吗,还是什么别的原因啊
头部代码:
<c:choose>
<c:when test="${sessionScope.loginInfo == null}">
<td width="39%" background="${pageContext.request.contextPath }/images/comm/userpass_bg.gif"; style="background-repeat:no-repeat"><table width="97%" height="24" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="48%" style="padding-left:20px;"><input type="text" name="username" id="username" value="${username }" style="width:90px; background:Transparent; border:0px;" /></td>
<td width="52%" style="padding-left:17px;"><input type="password" name="password" id="password" style="width:90px; background:Transparent; border:0px;" /></td>
</tr>
</table></td>
<td width="7%" align="center"><input type="image" name="button2" id="butt11" src="${pageContext.request.contextPath }/images/comm/butt11.gif" onclick="login()"/></td>
<td width="11%" align="center"><input type="image" name="button2" id="butt12" src="${pageContext.request.contextPath }/images/comm/butt12.gif" onclick="window.open('${pageContext.request.contextPath }/register/reg.jsp');"/></td>
<td width="14%"><span onclick="var strHref=window.location.href;this.style.behavior='url(#default#homepage)';this.setHomePage('http://localhost:8080/website');" style="CURSOR: hand">设为首页</span> | 帮助</td>
</c:when>
<c:otherwise>
<td width="14%">${sessionScope.loginInfo.username } | <a href="javascript:exit();">退出</a> | <span onclick="var strHref=window.location.href;this.style.behavior='url(#default#homepage)';this.setHomePage('http://localhost:8080/website');" style="CURSOR: hand">设为首页</span> | 帮助</td>
</c:otherwise>
</c:choose>
但是当进入别的页面后,只有刷新以后才会显示登录状态。退出后,只有刷新后,别的页面才显示退出状态,请问怎么回事啊,我用过HttpServletResponse response = runData.getResponse();
2. response.setHeader("Pragma","No-cache");
3. response.setHeader("Cache-Control","no-cache");
4. response.setDateHeader("Expires", 0);
不管用。请问还有别的方法吗,还是什么别的原因啊
头部代码:
<c:choose>
<c:when test="${sessionScope.loginInfo == null}">
<td width="39%" background="${pageContext.request.contextPath }/images/comm/userpass_bg.gif"; style="background-repeat:no-repeat"><table width="97%" height="24" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="48%" style="padding-left:20px;"><input type="text" name="username" id="username" value="${username }" style="width:90px; background:Transparent; border:0px;" /></td>
<td width="52%" style="padding-left:17px;"><input type="password" name="password" id="password" style="width:90px; background:Transparent; border:0px;" /></td>
</tr>
</table></td>
<td width="7%" align="center"><input type="image" name="button2" id="butt11" src="${pageContext.request.contextPath }/images/comm/butt11.gif" onclick="login()"/></td>
<td width="11%" align="center"><input type="image" name="button2" id="butt12" src="${pageContext.request.contextPath }/images/comm/butt12.gif" onclick="window.open('${pageContext.request.contextPath }/register/reg.jsp');"/></td>
<td width="14%"><span onclick="var strHref=window.location.href;this.style.behavior='url(#default#homepage)';this.setHomePage('http://localhost:8080/website');" style="CURSOR: hand">设为首页</span> | 帮助</td>
</c:when>
<c:otherwise>
<td width="14%">${sessionScope.loginInfo.username } | <a href="javascript:exit();">退出</a> | <span onclick="var strHref=window.location.href;this.style.behavior='url(#default#homepage)';this.setHomePage('http://localhost:8080/website');" style="CURSOR: hand">设为首页</span> | 帮助</td>
</c:otherwise>
</c:choose>
解决方案 »
- jstl1.2的问题.jstl1.2对应的tld的jar包在哪?
- 关于调用web服务报错No deserializer for {http://www.w3.org/2001/XMLSchema}anyType错误
- awt窗口问题
- 有人用过SVF吗?
- 请教:struts2中 传参乱码问题
- Spring jdbcTamplate查询
- 请教一个很奇怪的问题
- 按照旧版本WebLogic时,它所带的Jdk1.3把我的jdk1.5覆盖了,怎么办?
- 谁有会话BEAN调用实体BEAN的例子?我非常需要!
- jsp+servlet+Ejb.....
- 菜鸟请教这条sql语句哪里有问题!
- 如何自定义配置jboss服务器
每次访问页面时;