页面自动跳转(如3秒跳转)

package com.login;

//实现成功登陆后自动跳转功能

import java.io.IOException;
import java.nio.charset.Charset;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
 * Servlet implementation class login1
 */
public class login1 extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//response.setch

text1(request,response);

}
private void text1(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
//实现自动跳转功能
String message="<meta http-equiv='refresh' content='3;url=/text/index.jsp'>恭喜你,登陆成功!本页面将在3秒后跳转如果没有,请点击<a href=''>超链接</a>";
this.getServletContext().setAttribute("message", message);
this.getServletContext().getRequestDispatcher("/message.jsp").forward(request, response);


/* response.setCharacterEncoding("UTF-8");
response.setContentType("text/html,Charset=UTF-8");
response.setHeader("refresh", "3;url=/text/index.jsp");*///定时刷新,3秒
}

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request,response);
}
}
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
404页面2自动跳转到首页 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>很抱歉,网站搬新家啦!</title> <style type="text/css"> body {margin: 0px; padding:0px; font-family:"微软雅黑", Arial, "Trebuchet MS", Verdana, Georgia,Baskerville,Palatino,Times; font-size:16px;} div{margin-left:auto; margin-right:auto;} a {text-decoration: none; color: #1064A0;} a:hover {color: #0078D2;} img { border:none; } h1,h2,h3,h4 { /* display:block;*/ margin:0; font-weight:normal; font-family: "微软雅黑", Arial, "Trebuchet MS", Helvetica, Verdana ; } h1{font-size:44px; color:#0188DE; padding:20px 0px 10px 0px;} h2{color:#0188DE; font-size:16px; padding:10px 0px 40px 0px;} #page{width:910px; padding:20px 20px 40px 20px; margin-top:80px;} .button{width:180px; height:28px; margin-left:0px; margin-top:10px; background:#009CFF; border-bottom:4px solid #0188DE; text-align:center;} .button a{width:180px; height:28px; display:block; font-size:14px; color:#fff; } .button a:hover{ background:#5BBFFF;} </style> </head> <body> <div id="page" style="border-style:dashed;border-color:#e4e4e4;line-height:30px;background:url(sorry.png) no-repeat right;"> <h1>腹有诗书气自华~</h1> <h2>言书库,完本小说在线阅读网址 </h2> <meta http-equiv="refresh" content="1.5;url=http://www.yanshuku.com"> <font color="#666666">2内,若网页未能自动跳转,请点击下面按钮进行跳转!</font><br /><br /> <div class="button"> <a href="http://www.yanshuku.com" title="进入首页">立即进入首页</a> </div> </div> </body> </html>

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值