|
|
|
list.add(“Vermont”);
list.add(“Virginia”);
list.add(“Washington”);
list.add(“West Virginia”);
list.add(“Wisconsin”);
list.add(“Wyoming”);
List itemsFound = new ArrayList();
Iterator it = list.iterator();
while (it.hasNext())
{
String s = (String) it.next();
if((s.toLowerCase()).startsWith(prefix.toLowerCase()))
{
itemsFound.add(s);
}
}
return itemsFound;
}
}
This backing bean has method “getSuggestItems()” which
takes one String parameter and returns a List object. The
string parameter “prefix” is the string entered by the user
while entering the name of the state in the page. The entered
string is checked in the list “list” of all states and the selected
states are returned as an another list “itemsFound”. This set
of states is shown at the time when the user enters the name
of state in the field.
|
|
|
|
August 2007 | Java Jazz Up | 17 |
|
|
|
Pages: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, |
31, 32, 33, 34, 35, 36, 37, 38, 39, 40 Download PDF |
|
|
|
|
|
|
|
|