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.

Your instinct might be to simply define a page parameter mapped to the selection value binding with the org.jboss.seam.ui.EntityConverter converter. It's a good thought, but this won't work since page parameters do not support multiple values. You wouldn't specify more than one selection (same parameter appearing more than once in the query string). For that reason, this is outside of the realm of what Seam can handle out of the box. That means defining your own converter.

One solution would be to write a converter that segments a comma separated list of values and passes each value through Seam's EntityLoader framework. By that I mean you should use the same API that the EntityConverter uses.

public String getAsString(FacesContext facesContext, UIComponent cmp, Object value) throws ConverterException
    List selections = new ArrayList();
    String[] ids = ((String) value).split(",");
    for (String id : ids) {
    return selections;

Register the converter with JSF and use it when binding the page parameter:

<param name="selections" value="#{bean.selections}" converterId="my.selectionConverter"/>

The query string would the contain a parameter such as this:


Keep in mind that the EntityManager used to load the selections must be the same EntityManager that loads the options of the select box. Otherwise, JSF will not think that the selections are equal to any of the options (equality is based on object identity).