private List<SiteDetails> SiteInfo = new ArrayList<SiteDetails>(); public List<SiteDetails> getSiteData() { int i = 0; //Entering Try catch System.out.println("Entering Try catch..."); try { // get the current database being used, Faces style Database database = (Database) FacesContext.getCurrentInstance() .getApplication().getVariableResolver().resolveVariable( FacesContext.getCurrentInstance(), "database"); System.out.println("Database Obtained..." + database); //Find the view in question View view = database.getView("SiteListings"); System.out.println("View Obtained..." + view); Document sDoc; Document ndoc; sDoc = (Document) view.getFirstDocument(); System.out.println("Document Obtained..." + sDoc); while (sDoc !=null) { System.out.println(sDoc.getItemValueString("SiteName")); SiteInfo.add(i, new SiteDetails(sDoc.getItemValueString("SiteName"),sDoc.getItemValueString("SiteNumber"),sDoc.getItemValueString("Directions"))); i++; //Get the next document in the view and store to the placeholder ndoc = (Document) view.getNextDocument(sDoc); //recycle the doc object to preserve memory sDoc.recycle(); //set the doc object equal to the placeholder sDoc = ndoc; } } catch (Exception e) { System.out.println("Error Data : " + e.getMessage()); } return SiteInfo; }