1 Reply Latest reply on Aug 15, 2007 1:51 PM by Fredrik Forsberg

    session scoped variable lost after page action

    Fredrik Forsberg Newbie


      I have a facelet view that triggers an page action when it loads.

      <page view-id="/userPage.xhtml">
       <param name="member" value="#{visitedUserAction.member}" />
       execute="#{visitedUserAction.initContentProviderAccount}" />

      public class VisitedUserActionBean implements VisitedUserAction {
       private String segment;
       private String member;
       private ContentProviderAccountDao contentProviderAccountDao;
       @Out(required = false, scope = ScopeType.SESSION)
       private ContentProviderAccount contentProviderAccount;
       private Log log;
       public void initContentProviderAccount() {
       log.info("getting current visited contentProviderAccount for page=" + member);
       ContentProviderAccount contentProviderAccount = null;
       try {
       contentProviderAccount = contentProviderAccountDao.findByStageUrlName(member);
       log.info("fetched contentProviderAccount=" + contentProviderAccount);
       if (contentProviderAccount.getProviderSegment().name().toLowerCase()
       .equals(segment.toLowerCase())) {
       log.info("setting contentProviderAccount to " + contentProviderAccount);
       this.contentProviderAccount = contentProviderAccount;
       } else {
       // fixme: redirect to either user not found page or search page
       throw new RuntimeException("user does not exist in segment, however there is one in: "
       + contentProviderAccount.getProviderSegment().toString());
       } catch (ContentProviderAccountDaoException e) {
       // fixme: redirect to either user not found page or search page
       throw new RuntimeException("user is not found ");
       public void logthis() {
       log.info("will this run?");
       public String getSegment() {
       return segment;
       public void setSegment(String segment) {
       this.segment = segment;
       public String getMember() {
       return member;
       public void setMember(String member) {
       this.member = member;
       public void destroy() {

      Then I want to find the sessionscoped variable and inject it into another stateful bean.

      public class ArtistPresentationActionBean extends com.yourstardom.middle.ArtistPresentationActionBase
       implements com.yourstardom.middle.ArtistPresentationActionLocal,
       com.yourstardom.middle.ArtistPresentationActionRemote {
       private ContentProviderAccount contentProviderAccount;

      This works fine when I do a non-faces request to the view but when I execute an action in the ArtistPresentationActionBean from the view and the response is rendered, contentProviderAccount is null and I get the exception

      Caused by javax.el.ELException with message: "javax.ejb.EJBTransactionRolledbackException: In attribute requires non-null value: artistpresentation.contentProviderAccount"