Please enable cookie support in your browser, otherwise some features of this website will not work. Cookies are used only for temporary client identification and destroyed when you quit the browser.
Help

Built with Seam

You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.

In my example below, i have an inquiry entity that has a country drop down. So in my action class i have a factory method that retrieves all countries and outjects to event scope to be called in my selectOneMenu.

InquiryAction class:

@SuppressWarnings("unchecked")
    @Factory(value = "countriesList", scope = ScopeType.EVENT)  
     public List<Country> getCountriesList() {  
     return entityManager.createNamedQuery("Country.findAll").getResultList();  
     } 

Inquiry.xhtml

<s:decorate id="countryField" template="layout/edit.xhtml">
                <ui:define name="label">Country</ui:define>
                <h:selectOneMenu id="country" value="#{newInquiry.address.countryCode}" required="true">
<s:selectItems var="_country" value="#{countriesList}"
label="#{_country.countryName}" noSelectionLabel="-- Select --"/>
	<s:convertEntity/> 		
	</h:selectOneMenu>
            </s:decorate>