posts - 0,  comments - 0,  trackbacks - 0

     If you add a redirect element after to-view-id, then the JSP container terminates the current request and sends an HTTP redirect to the client. The redirect response tells the client which URL to use for the next page.

    Redirecting the page is slower than forwarding because another round trip to the browser is involved. However, the redirection gives the browser a chance to update its address field.

Figure 3-8 shows how the address field changes when you add a redirection element, as follows:

<navigation-case>
      
<from-outcome>success</from-outcome>
      
<to-view-id>/success.jsp</to-view-id>
      
<redirect/>
</navigation-case>

Without redirection, the original URL (localhost:8080/javaquiz/index.faces) is unchanged when the user moves from the /index.jsp  page to the /success.jsp face. With redirection, the browser displays the new URL (localhost:8080/ javaquiz/success.faces).

Tip

Use the redirect element for pages that the user might want to bookmark.

                                                          上文出自:《core JavaServer™ Faces, Second Edition》
posted on 2007-12-11 18:09 *一凡* 阅读(340) 评论(0)  编辑  收藏 所属分类: JSF