Apache Jakarta Struts

Struts is a framework based on Model-View-Controller.

html:select

Nested within a html:select are:

html:option

Individual options are listed, one per entry

html:options

many

html:optionsCollection

Create a collection of beans. In the example below a collection of Accounts has been added to request scope.

[
        List<Account> accounts = getAccountingService().getAccounts();
        request.setAttribute("accounts", accounts);
      

The account bean has an id, and a currency property. The getters are hidden.

[
public class Account {
    private Long id;
    private Currency currency;
}
      

JSP code is below.

[
    <html:select property="id">
      <html:optionsCollection name="accounts" value="id" label="currency"/>
    </html:select>
            
      

Published: Thursday, 20 May 2004