First of all, All is done in JSF 1.2. In short, I have this code:
public class MobileConfigurationToolSessionListener implements HttpSessionListener { @Override public void sessionCreated(HttpSessionEvent event) { ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext(); externalContext.getSessionMap().put("myBean", new MyBean()); } ... } The bean is accessed from the JSF context as a regular JSF session bean.
<h:outputText value="#{myBean.textMsg}"/> The result is an almost infinite loop which finally ends due to:
011-04-06 15:47:42,435 WARN [http-80-1] org.apache.myfaces.shared_impl.renderkit.html.HtmlGridRendererBase PanelGrid GeneralConfigForm:j_id_jsp_1651416019_7:0:GeneralDetailPanel has not enough children. Child count should be a multiple of the columns attribute. 2011-04-06 15:47:42,825 IDT] E 0000000c (org.apache.catalina.connector.CoyoteAdapter#service) An exception or error occurred in the container during the request processing ava.lang.ArrayIndexOutOfBoundsException What I'm trying to achieve is to create a bean object by my self (According to URL parameters or cookies) in the session listener and "inject" the new bean to the JSF session.
What Am I doing wrong?
Thanks!
EDIT- I thought that another solution could be to make the myBean instantiate somehow by JSF and then run methods on it to achieve the same idea. I remember a @BalusC article on how to make JSF instantiate a bean from code but I couldn't find it. (I'm Guessing @BalusC will answer me on this so thanks in advance :-) )