< Previous | Next >

Completed customersearch.egl file after lesson 2

This code is the version of the customersearch.egl file completed after lesson 2. If you see any errors marked by red X symbols in the file, make sure your code matches this code:
package jsfhandlers;

import com.ibm.egl.jsf.UIViewRoot;
import eglderbydb.data.*;
import libraries.SearchLibrary;


handler customersearch type JSFHandler
	{onConstructionFunction = onConstruction, 
	 onPrerenderFunction = onPrerender, 
 	 view = "updatecustomer.jsp",
 	 viewRootVar = viewRoot} 

	viewRoot UIViewRoot;
	searchTerms Customer;
	searchResults Customer[0];
	resultMessage CHAR(80);
	numberOfResults INT;

	// Function Declarations
	function onConstruction()
	end
	
	function onPrerender()
		if (searchResults.getSize() == 0)
			resultMessage = "No customers found or no search criteria entered.";
		end
	end

	function searchFunction()
		searchTerms.LastName = searchTerms.LastName::"%";
		SearchLibrary.NameAndStateSearch_And(
			searchTerms.LastName, 
			searchTerms.State, searchResults);
		resultMessage = " customer(s) found.";
		numberOfResults = searchResults.getSize();
	end
end

Return to Lesson 2: Add code for the search function.

< Previous | Next >

Feedback