天天看点

Struts的和的区别

假设有两个jsp-index.jsp和aaa.jsp在一个context下 http://localhost:81/test

<logic:redirect href="" target="_blank" rel="external nofollow" /> 直重定向到href执行页面

<logic:redirect page=""/>利用相对地址来控制转发,在本模块的url中增加page属性对应的URI生成的重定向地址

比如我们在index.jsp中写 <logic:redirect href="/aaa.jsp" target="_blank" rel="external nofollow" ></logic:redirect>

访问http://localhost:81/test/index.jsp 会自动定向到http://localhost:81/test/aaa.jsp

如果我们在index.jsp中写<logic:redirect page="/aaa.jsp"></logic:redirect>

访问http://localhost:81/test/index.jsp 会自动定向到http://localhost:81/testaaa.jsp  (肯定是错误的,要写/aaa.jsp,因为page的内容是直接加在原URL上的)