Apache Jakarta Struts

Published: Thursday, 20 May 2004

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 not shown.

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>

Links

The Apache Struts Web Application Framework