webtier@glassfish.java.net

<h:inputText> in a <ui:repeat>

From: <webtier_at_javadesktop.org>
Date: Tue, 16 Mar 2010 04:51:12 PDT

I'm trying to use the <ui:repeat> tag as a DataTable, but the data does not seem to be sent to the Managed Bean. Is it possible to use <ui:repeat> for editable data?

This is what I'm trying to do:

edit-place:xhtml

[i]
[...]
<ui:repeat id="localizable_data" var="localizedPlace" value="#{places.localizableData}">
        <fieldset id="localized_#{localizedPlace.locale}" class="localizable_data">
                <legend>#{localizedPlace.locale.displayName}</legend>
                <h:panelGrid columns="3">
                        <h:outputText styleClass="label" value="#{msg.name}" />
                        <h:inputText id="name" value="#{localizedPlace.name}" size="30" />
                        <h:message id="nameError" for="name" styleClass="error" />
                </h:panelGrid>
        </fieldset>
</ui:repeat>
[...]
[/i]

PlacesBean.java
[i]
[...]
        public List<LocalizedPlace> getLocalizableData() {
                List<LocalizedPlace> localizableData = new ArrayList<LocalizedPlace>();
                for (Locale locale : LocaleFactory.getAllLocales()) {
                        LocalizedPlace locPlace = getItem().getLocalizedItem(locale);
                        if(locPlace == null)
                        {
                                locPlace = new LocalizedPlace();
                                locPlace.setLocale(locale);
                        }
                        localizableData.add(locPlace);
                }
                return localizableData;
        }
        
        public void setLocalizableData(List<LocalizedPlace> localizableData) {
                getItem().clearLocalizedData();
                for (LocalizedPlace localizedPlace : localizableData) {
                        if(!localizedPlace.getName().equals("")) {
                                getItem().putLocalizedItem(localizedPlace);
                        }
                }
        }
[...]
[/i]

I've put a Breakpoint in the first line of setLocalizableData method, but never stops there.

The fields outside of the <ui:repeat> are been read correctly.
[Message sent by forum member 'epsa' (emiperez_at_fiestas.net)]

http://forums.java.net/jive/thread.jspa?messageID=392140