[jboss-user] [JBoss Seam] - session scoped variable lost after page action
FredF
do-not-reply at jboss.com
Wed Aug 15 12:33:47 EDT 2007
Hello
I have a facelet view that triggers an page action when it loads.
<page view-id="/userPage.xhtml">
| <param name="member" value="#{visitedUserAction.member}" />
| <action
| execute="#{visitedUserAction.initContentProviderAccount}" />
| </page>
@Stateful
| @Name("visitedUserAction")
| @AutoCreate
| public class VisitedUserActionBean implements VisitedUserAction {
|
| private String segment;
|
| private String member;
|
| @EJB
| private ContentProviderAccountDao contentProviderAccountDao;
|
| @Out(required = false, scope = ScopeType.SESSION)
| private ContentProviderAccount contentProviderAccount;
|
| @Logger
| 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 ");
| }
|
| }
|
| @Create
| 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;
| }
|
| @Destroy
| @Remove
| public void destroy() {
| }
|
| }
Then I want to find the sessionscoped variable and inject it into another stateful bean.
@javax.ejb.Stateful
| @Name("artistpresentaton")
| public class ArtistPresentationActionBean extends com.yourstardom.middle.ArtistPresentationActionBase
| implements com.yourstardom.middle.ArtistPresentationActionLocal,
| com.yourstardom.middle.ArtistPresentationActionRemote {
|
| @In
| 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"
why?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4074506#4074506
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4074506
More information about the jboss-user
mailing list