1.Create a text Box
2.Inside the text box drag and drop a autoSuggestBehaviour component
3.In the SuggestedItems create a managed bean for countrySuggester.getCountries
4.Now your Jsf will look like this,
<af:inputText label="Country" value="#{item.country}"
columns="20" id="it5">
<af:autoSuggestBehavior suggestedItems="#{countrySuggester.getCountries}"/>
</af:inputText>
5.In the countrySuggester class make it as this,
import java.util.ArrayList;
import java.util.List;
import javax.faces.model.SelectItem;
public class CountrySuggester {
private List<SelectItem> countries = new ArrayList<SelectItem>();
public CountrySuggester() {
super();
countries.add(new SelectItem("Belgium"));
countries.add(new SelectItem("Hungary"));
countries.add(new SelectItem("Bulgaria"));
countries.add(new SelectItem("India"));
countries.add(new SelectItem("Indonesia"));
countries.add(new SelectItem("United Kingdom"));
countries.add(new SelectItem("United States of America"));
countries.add(new SelectItem("Netherlands"));
countries.add(new SelectItem("Nepal"));
countries.add(new SelectItem("Namibia"));
}
public List<SelectItem> getCountries(String country) {
List<SelectItem> items = new ArrayList<SelectItem>();
for(SelectItem item:countries){
if (item.getLabel().startsWith(country)) {
items.add(item);
}
}
return items;
}
}
Tuesday, September 28, 2010
Guidelines for ADF Beginners
See the following links which demonstrates the Step by Step procedure for using ADF11g components
1.http://st-curriculum.oracle.com/obe/jdev/obe11jdev/ps1/ria_application/developriaapplication_long.htm
2.http://st-curriculum.oracle.com/obe/jdev/obe11jdev/ps1/boundedtaskflow/bounded_task_flow.html
3.http://st-curriculum.oracle.com/obe/jdev/obe11jdev/ps1/adf_richclient/adfrichclient.htm
1.http://st-curriculum.oracle.com/obe/jdev/obe11jdev/ps1/ria_application/developriaapplication_long.htm
2.http://st-curriculum.oracle.com/obe/jdev/obe11jdev/ps1/boundedtaskflow/bounded_task_flow.html
3.http://st-curriculum.oracle.com/obe/jdev/obe11jdev/ps1/adf_richclient/adfrichclient.htm
Example for ADF FacesMessage
1.Create a Button component
2.In the Button Action proerty bind it to the managed bean
3.In the method type the following code.
FacesContext fc = FacesContext.getCurrentInstance();
FacesMessage message = new FacesMessage("Hi this is your message");
fc.addMessage(null, message);
2.In the Button Action proerty bind it to the managed bean
3.In the method type the following code.
FacesContext fc = FacesContext.getCurrentInstance();
FacesMessage message = new FacesMessage("Hi this is your message");
fc.addMessage(null, message);
Subscribe to:
Posts (Atom)