-
1. jsf - reinit a session bean - managed bean lifecycle problem
diabolique Apr 20, 2011 1:20 PM (in response to diabolique)any help??
-
2. jsf - reinit a session bean - managed bean lifecycle problem
wesleyhales Apr 20, 2011 1:49 PM (in response to diabolique)Try using a seam page action (example here)
<page view-id="/home.xhtml">
<action execute="#{identity.login}" if="#{identity.loggedIn}"/>
<navigation from-action="#{identity.login}">
<render view-id="/main.xhtml"/>
</navigation>
....
-
3. jsf - reinit a session bean - managed bean lifecycle problem
diabolique Apr 21, 2011 10:35 AM (in response to wesleyhales)Hi, thanks for the reply.
I don't use seam in my project. So, how seam reinit the bean with your code? I don't understand.
Is it similar to faces-config.xml!
-
4. jsf - reinit a session bean - managed bean lifecycle problem
diabolique Apr 28, 2011 6:24 AM (in response to diabolique)This is my workaround:
-in every xhtml page (portlet1 has an initial page page1, portlet2 has an initial page page2,...) I've add an <h:outputText value="{Portlet1JSFBean.clean}">
-in Portlet1JSFBean, Portlet2JSFBean,... "clean" is a simple String variable
-in the getter method I've add some custom code:
public String getClean() {
if (<httpSession>.getAttribute(PORTLET_ALIVE) != null && !<httpSession>.getAttribute(.PORTLET_ALIVE).equals(SESSION_BEAN_PORTLET1))
//cleanJsfSession
FacesContext.getCurrentInstance().getExternalContext().getSessionMap().remove(SESSION_BEAN_PORTLET1_NAME);
return clean;
}
-in every constructor of jsf beans:
<httpSession>.setAttribute(PORTLET_ALIVE, SESSION_BEAN_PORTLET1_NAME);
In this way, every portlet/jsfBean says: "I'm the current portlet alive", and when I change the portal page (see another portlet), getClean() reinizialize the current session bean.
@keepalive (richfaces) instead, is ok for a page bean, but only for navigation in the specific portlet. If you change the portal page, the jsf bean (session, request, or page is the same) isn't reinizialized.
Is ok ?
Thanks
-
5. Re: jsf - reinit a session bean - managed bean lifecycle problem
el_dambro Sep 8, 2011 9:36 AM (in response to diabolique)Yes I think it's ok! With some adjustments for referers and refreshes of the page it will work!