天天看點

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上的)