servlet跳转jsp的第三种方式

Posted shouyaya

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了servlet跳转jsp的第三种方式相关的知识,希望对你有一定的参考价值。

除重定向和转发方式跳转jsp页面还可通过respond.getWriter().print()写入一个js标签设置href=“”进而跳转

如:

response.getWriter().print("<script type=\\"text/javascript\\">parent.location.href=\\"/login.jsp\\"</script>");

此时通过设置parent.location.href的可以使子模块跳转页面时,不会只在本模块下跳转,而转到父模块下跳转

即不会出现下面这样跳转:

 

 


以上是关于servlet跳转jsp的第三种方式的主要内容,如果未能解决你的问题,请参考以下文章