seam有個一個內(nèi)置的component,叫做redirect。它具有獲取當(dāng)前view的能力當(dāng)?shù)玫降顷懯跈?quán)后,可以直接獲得登錄前的地址進行訪問。
在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>