response.sendRedirect的问题!

boleynlong 2003-03-13 06:15:04
A.jsp |B.jsp
<html> |<html>
<body> |<body>
..... |……
<% |你好!
if(条件满足) |……
response.sendRedirect(B.jsp) |</body>
%> |</html>
…… |
</body> |
</html> |
——————————————————|——————————————————
执行A.jsp(条件满足)后,在B.jsp页面上方出现:
“HTTP/1.1 200 OK Content-Type: text/html Content-Length: 15105 ETag: "15105-1047538984000" Date: Thu, 13 Mar 2003 08:12:32 GMT Server: Apache Tomcat/4.0-m5 (HTTP/1.1 Connector) Last-Modified: Thu, 13 Mar 2003 07:03:04 GMT ”
但刷新页面,上面这些提示就没了。有什么办法,可以不让以上提示出现吗?(在不要刷新页面的情况下)
...全文
46 15 打赏 收藏 转发到动态 举报
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
remanwang 2003-03-18
  • 打赏
  • 举报
回复
response.sendRedirect(B.jsp)执行之前不能使用out.print,你的<html>这样的代码经tomcat编译后也是用out.print,所以出错
yaray 2003-03-18
  • 打赏
  • 举报
回复
同意上面的
凋零的老树 2003-03-18
  • 打赏
  • 举报
回复
if(条件满足)
{
response.sendRedirect(B.jsp);
return;
}
headstream 2003-03-14
  • 打赏
  • 举报
回复
好象是不能有out.print之类的东西,还有,你是不是忘了引号:
response.sendRedirect("B.jsp")
caicaibao 2003-03-14
  • 打赏
  • 举报
回复
想起来了啊,response.sendRedirect(),之前好象不能有out.print等一些语句的吧,你看看是不是这个问题啊
caicaibao 2003-03-14
  • 打赏
  • 举报
回复
是不是你的Tomcat的问题啊,语法没错啊
boleynlong 2003-03-14
  • 打赏
  • 举报
回复
把response.sendRedirect(B.jsp)替换pageContext.forward("B.jsp");后,也没用啊!
hxp121212 2003-03-14
  • 打赏
  • 举报
回复
把a.jsp改成用
<%if(条件满足){%>
<jsp:forward page="b.jsp"/>
<%}else{%>
<jsp:forward page="..."/>
<%}%>
hch9230 2003-03-14
  • 打赏
  • 举报
回复
A.jsp

<%.....
if(条件满足)
response.sendRedirect(B.jsp);
%>
<html>
<body>
.....
....
</body>
</html>
flashroom 2003-03-14
  • 打赏
  • 举报
回复
pageContext.forward("B.jsp");

用这个试下
boleynlong 2003-03-14
  • 打赏
  • 举报
回复
好象还是不行哦!
boleynlong 2003-03-14
  • 打赏
  • 举报
回复
1:response.sendRedirect(),之前没有out.println
2:在response.sendRedirect("B.jsp")我在程序中是很引号的,不然的话,程序会报错的啊
我这里没有语法报错啊。我想是不是类似缓存什么的东西在作怪呢?

我试过前面几位朋友说的刷新方式,但都不起作用。我就是想让他能够自动刷新!
要不就改用script语句。
<%
if(条件满足)
script语句//打开另一个页
%>
…………
aivinok 2003-03-13
  • 打赏
  • 举报
回复
你在B.JSP中的头部<head></head>中加入这个.
<META http-equiv="refresh" content="3">
刷新率3秒.
给分.我现在穷死了
boleynlong 2003-03-13
  • 打赏
  • 举报
回复
谢谢,我看看
sasa_sasa 2003-03-13
  • 打赏
  • 举报
回复
你试一下在B.jsp页面上用自动刷新..
网上有贴子.你搜索一下..

81,090

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧