yangj-Blog

JSP 跳转

1、转发:request.getRequestDispatcher(".jsp").forward(request,response);
2、重定向:response.sendRedirect("success.jsp");
转发,前后页面共享一个request,重定向是重新定向  前后页面不是一个request
3、<jsp:forward page="URL"/>

js页面的跳转方式:

        window.location.href="URL";

 

html页面跳转

1、html中使用meta中跳转,通过meta可以设置跳转时间和页面

<head>
<!--只是刷新不跳转到其他页面 -->
<meta http-equiv="refresh" content="5">
<!--定时转到其他页面 -->
<meta http-equiv="refresh" content="5;url=index.html"> 
</head>

2.a标签直接跳转

<a href="http://baidu.com">百度一下</a>

3.表单与按钮的跳转

<input type="button" value="我是一个按钮" onclick="javascrtpt:window.location.href=\'http://blog.sina.com.cn/mleavs\'">

方法二:触发一个函数跳转

<script>
function jump(){
window.location.href="http://blog.sina.com.cn/mleavs";
}
</script>

<input type="button" value="我是一个按钮" onclick=javascrtpt:jump()>

方法三:a标签的超链接可以直接嵌套一个button

<a href="https://www.baidu.com/">
<button>点我跳转到度娘!</button>
</a>

方法四:表单的action定向提交跳转

<form action="xx.html" method="post">
<input type="bottom" value="按钮">
</from>

 





分类:

技术点:

相关文章:

  • 2022-02-24
  • 2021-05-23
  • 2021-12-31
  • 2021-12-05
  • 2021-09-04
  • 2021-12-07
  • 2021-10-05
猜你喜欢
  • 2021-12-31
  • 2022-01-08
  • 2021-08-11
  • 2023-02-23
  • 2021-10-24
相关资源
相似解决方案