<h:dataTable value="#{elements}" var="element">
| <h:inputText value="#{element.foo}" />
| <h:inputText value="#{element.bar}" />
| </h:dataTable>
| <h:commandButton action="#{elementManager.save}" />
@Name("elementManager")
| public class ElementManager {
|
| @In(create=true) @Out private List<Element> elements;
| ...
| @Factory("elements")
| public void build() {
| elements = new ArrayList<Element>();
| for (int i = 0; i < 3; i++) {
| elements.add(new Element());
| }
| }
|
| public String save() {
| Iterator<Element> it = elements.iterator();
| while (it.hasNext()) {
| em.persist(it.next());
| }
| }
| }
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3965992#3965992
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3965992
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user