Below is my managed bean. In the constructor, I get a reference to the managed property from Spring just to verify that it is available. I placed breakpoints in the code at the getSiteList() method, and my breakpoint is never hit prior to the error occuring.
/**
*
*/
package com.warnerbros.mam.saw.jsf.page;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext
; import javax.servlet.ServletContext; import javax.servlet.http.HttpSession;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.ApplicationContext
;
import org.springframework.web.context.support.WebApplicationContextUtils;
import com.warnerbros.mam.saw.jsf.delegates.FtpSiteDelegate;
import com.warnerbros.mam.saw.jsf.exc.BaseViewException;
import com.warnerbros.mam.saw.model.user.SawUser
;
/**
* @author xfmahmou
*
*/
public class FtpSitesPage
{
/**
* Default no-args constructor
*/
public FtpSitesPage()
{
/**
// Test code to verify that the FtpSiteDelegate bean is being created by Spring
FacesContext facesContext = FacesContext.getCurrentInstance();
ServletContext servletContext = (ServletContext) facesContext.getExternalContext().getContext();
ApplicationContext applicationContext = WebApplicationContextUtils.getWebApplicationContext
(servletContext);
Map beans = applicationContext.getBeansOfType(FtpSiteDelegate.class);
FtpSiteDelegate f = (FtpSiteDelegate) beans.get("ftpSiteDelegate"); */ }
//PROPERTY: ftpSiteDelegate
public FtpSiteDelegate getFtpSiteDelegate() { return ftpSiteDelegate; } public void setFtpSiteDelegate(FtpSiteDelegate ftpSiteDelegate) { this.ftpSiteDelegate = ftpSiteDelegate; }
//PROPERTY: siteList
public List getSiteList()
{
// Retrieve SawUser from HttpSession
FacesContext facesContext = FacesContext.getCurrentInstance();
if (facesContext == null) { throw new NullPointerException("Retrieved NULL reference to FacesContext instance."); }
logger.debug("Retrieved reference to FacesContext instance.");
HttpSession session = (HttpSession) facesContext.getExternalContext().getSession(false);
if (session == null) { throw new NullPointerException("Retrieved NULL reference to HttpSession instance."); }
logger.debug("Retrieved reference to HttpSession instance.");
SawUser sawUser = (SawUser) session.getAttribute("SawUser");
if (sawUser == null) { throw new NullPointerException("Retrieved a NULL reference to the SawUser object retrieved from the HttpSession"); }
logger.debug("Retrieved a SawUser object from the HttpSession with userId = " + sawUser.getUserId());
List sites = null;
try
{
sites = this.ftpSiteDelegate.getFtpSitesBySawUser(sawUser);
}
catch (BaseViewException e)
{
logger.error(e);
//TODO: FacesMessage here
sites = new LinkedList();
}
if (sites == null)
{
// TODO: FacesMessage here
NullPointerException e = new NullPointerException("Retrieved a NULL reference to a List of FtpSite objects.");
logger.error(e);
sites = new LinkedList();
}
logger.debug("Returning a List of FtpSites objects for SawUser, userId = " + sawUser.getUserId());
return sites;
}
// View Associations
private FtpSiteDelegate ftpSiteDelegate;
// Private constant members
private final Log logger = LogFactory.getLog(this.getClass());
}
-----Original Message-----
From: octoberdan [mailto:
[EMAIL PROTECTED]]
Sent: Tuesday, August 08, 2006 2:27 PM
To: [email protected]
Subject: Re: Issue with referencing a ManagedBean
Do you mind posting your managedbean?
--
View this message in context: http://www.nabble.com/Issue-with-referencing-a-ManagedBean-tf2074677.html#a5715417
Sent from the MyFaces - Users forum at Nabble.com.
- Issue with referencing a ManagedBean Faisal Mahmoud
- RE: Issue with referencing a ManagedBean David Friedman

