-
1. Re: JSF Portlet - managed bean lifecycle issue
diabolique Apr 5, 2011 8:03 AM (in response to diabolique)Any help?
I've this requirement: a "page scope" managed bean (request is too short, session is too long and not is restored when I recall a page from menu; page bean is available from jsf 2.0 that isn't supported by portlet bridge 2.0, it's true?)
I've tryed with:
-rich faces "@keepalive" but don't work with gatein --> is the same of a session scoped bean
-myfaces tomahawk extension --> don't work: the plugin start, but the bean is a simple request bean, nothing is stored
Anyone has this same issue/requirement? Possible?
-
2. Re: JSF Portlet - managed bean lifecycle issue
wesleyhales Apr 5, 2011 8:48 AM (in response to diabolique)JBoss Portlet Bridge 3.0 supports JSF 2.0 and is in Alpha atm.
I have no idea if you need to define another view handler as I haven't used that specific extension. Your may need to do some kind of init() when you need to refresh your bean. It would help if you could attach a sample project with source.
-
3. Re: JSF Portlet - managed bean lifecycle issue
diabolique Apr 8, 2011 11:13 AM (in response to wesleyhales)Thanks for the reply.
But in production I can't use an alpha version.
Yes, I need an init(), but how can I call this init() method at page reload/refresh (in particular: when the call isn't a postback)??
With jsf extension, tomahawk, rich faces @keepalive, this is possible, but with portlet bridge + jsf 1.2 + richfaces?
- rich faces @keepalive on a request managed bean: the bean became a simple SESSION bean (at page reload/refresh it isn't reinitiated)
- tomahawk (myfaces plugin): the plugin is registered, but the bean is a simple request bean (reinit for all action)
- jsf webui extension: problem in first post
So, HOW CAN I REINIT A JSF SESSION MANAGED BEAN AT PAGE REFRESH/RELOAD (when isn't a postback)?
thanks
-
4. JSF Portlet - managed bean lifecycle issue
diabolique Apr 27, 2011 4:52 AM (in response to diabolique)any help?
-
5. JSF Portlet - managed bean lifecycle issue
diabolique Apr 28, 2011 6:23 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