[jboss-user] [JBoss Seam] - Re: Is it possible to connect JSF fields to a List of Entity
petemuir
do-not-reply at jboss.com
Fri Aug 18 05:42:28 EDT 2006
<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
More information about the jboss-user
mailing list