struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Fröhlich <>
Subject ModelDriven with List<MyUserObject>
Date Thu, 27 Jan 2011 13:37:45 GMT

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...

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

    public void save() {

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

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

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

<%@ 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:textfield name="boId" />
        <s:textfield name="name" />
    <s:submit />

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:
For additional commands, e-mail:

View raw message