Seam Not capturing view
seamsvictom Apr 3, 2009 12:48 PMHi,
I am facing an issue with seam to capture the old view. Here is the scenario:
I've configured this in components.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>
Now I've defined a page which requires login, here is that page's xml file (Note that I am using a separate pages.xml file for each page)
<page xmlns="http://jboss.com/products/seam/pages" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.1.xsd" no-conversation-view-id="/pages/view-cart.xhtml" login-required="true"> <param name="itemId" value="#{viewCartAction.itemId}" converterId="javax.faces.Long"/> </page>
Now, I want if a person is not logged in and access view cart, he should be redirected to login page first and then straight to view cart after logging in. It works fine if i use s link like this:
<s:link view="/pages/view-cart.xhtml"> <f:param name="itemId" value="1222"/> </s:link>
But now consider this scenario, At one page on click of a button, i outject a list of objects in conversation scope. Then I redirect the page to view-cart.xhtml page but in this case the user is not redirected to the login page, instead it is taken to view-cart directly :(
Just to give an examlple in my another bean I've the code:
//declared at top in class @out(required=false) private List<Item> items; //method public String buyItem(){ items = someitemsList; //list of some items return "/pages/view-cart.xhtml"; }
Now when buyItems method is invoked, it tries to redirect to view-cart page, in this case user should have taken to the login page, but this is not the case, instead it is taken to view-cart page :(
Does anybody know what am i doing wrong here?
Any help will be appreciated.
Thank you