目录

<c:redirect >

《c:redirect》标记通过促进自动URL重写将浏览器重定向到备用URL,它支持上下文相关URL,并且还支持《c:param》标记。

属性 (Attribute)

《c:redirect》标签具有以下属性 -

属性 描述 需要 默认
url 用于将用户的浏览器重定向到的URL YesNone
context /后跟本地Web应用程序的名称 No 目前的申请

例子 (Example)

如果您需要将参数传递给《c:import》标记,请使用《c:url》标记首先创建URL,如下所示 -

<%@ taglib uri = "http://java.sun.com/jsp/jstl/core" prefix = "c" %>
<html>
   <head>
      <title><c:redirect> Tag Example</title>
   </head>
   <body>
      <c:redirect url = "http://www.photofuntoos.com"/>
   </body>
</html>

以上代码将请求重定向到http://www.photofuntoos.com - 自己尝试一下。

↑回到顶部↑
WIKI教程 @2018