Hi....

After we found a lean solution with ModelDriven in our application to build 
CRUD functions with simple Objects, I have now a problem with extending it, to 
be usable with lists.

What I want to do is, make the getModel() method in my ModelDriven Action 
having a return type like List<MySimpleClass> or maybe Map<String, 
MySimpleClass> just to be able to have a form, where I iterate the list or map, 
have a input field for every line and just one "Save" button for the entire 
form, so every change is made to the object inside the list .

No idea if it helps, but this might show, what I want to do...

ACTION:
public class Document extends ActionSupport implements 
ModelDriven<List<Document>> {
        private List<Document> documents;

    public void save() {
        //doSomething
    }

    public Document getModel() {
        documents = DocumentsDAO.listDocuments();
        return documents;
    }

    public List<Document> getDocuments() {
        return documents;
    }

        public void setDocuments(List<Document> documents) {
        this.documents = documents;
    }
}

JSP:
<%@ page language="java" contentType="text/html; charset=UTF-8" 
pageEncoding="UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>

<s:url var="urlSave" action ="document" method="save" />
<s:form action="%{urlSave}">
    <s:iterator>
        <s:textfield name="boId" />
        <s:textfield name="name" />
    </s:iterator>
    <s:submit />
</s:form>

If anyone can point me out, how to do that, or provide a link or some buzzwords 
where I can continue my search I would be thankful.

Regards Jan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to