seam有個一個內置的component,叫做redirect。它具有獲取當前view的能力當得到登陸授權后,可以直接獲得登錄前的地址進行訪問。
在component.xml里添加:
<event type="org.jboss.seam.security.notLoggedIn">
<action execute="#{redirect.captureCurrentView}"/>
</event>
<event type="org.jboss.seam.security.postAuthenticate">
<action execute="#{redirect.returnToCapturedView}"/>
</event>