struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "alexj" <>
Subject Re: editable list using nested:iterate and lazyList
Date Wed, 05 Mar 2003 22:11:35 GMT
I give a sample is use when I need to populate an view :

I got an ActionForm :

public class StudentForm extends ActionForm {

private String formationSelected = "Analyste Programmeur";

private Collection formationList = null;

private Collection formationListID = null;

private Collection groupList = null;

private Collection groupListID = null;

private String group = "cycle 1a";




* Get the formationList.

* @return Collection.


public Collection getFormationList () {

formationList = Formation.getFormations();

return formationList;



* Get the formationListID.

* @return Collection.


public Collection getFormationListID () {

formationListID = Formation.getFormationsID();

return formationListID;



* Get the groupList.

* @return Collection.


public Collection getGroupList () {

groupList = Groupe.getGroupsOfStudent();

return groupList;



* Get the groupList.

* @return Collection.


public Collection getGroupListID () {

groupListID = Groupe.getGroupID();

return groupListID;



I got an viewstudent action :

public ActionForward execute(

ActionMapping mapping,

ActionForm form,

HttpServletRequest request,

HttpServletResponse response)

throws Exception {

Collection students = null;

StudentForm studentForm = (StudentForm) form;

students = getStudents ();

HttpSession session = request.getSession();

session.setAttribute("students", students);

return mapping.findForward("viewstudent");



* Get all students.


protected ArrayList getStudents () {

return Student.getStudents();


And my jsp view for studentview is :

<%@ page session="true" %>
<%@ page import="org.apache.taglibs.display.test.TestList,
<%@ taglib uri="" prefix="display"
<%@ taglib uri="/WEB-INF/struts-menu.tld" prefix="menu"%>


  <script language="JavaScript1.2" src="./scripts/coolmenus3.js">
  <script src="./scripts/coolmenu-config.js">

<menu:useMenuDisplayer name="CoolMenu"


    <menu:displayMenu name="ToDoListMenuFile"/>
    <menu:displayMenu name="ToDoListMenuEdit"/>
    <menu:displayMenu name="CaseDetailMenuCase"/>

<display:table width="85%"align="left"

  <display:column property="idPersonne" title="ID"
                  paramProperty="idPersonne"  />
  <display:column property="name" title="Nom"/>
  <display:column property="firstName" title="Prénom"/>
  <display:column property="adress" title="Adresse"/>
  <display:column property="city" title="Ville"/>
  <display:column property="npa" title="Npa"/>
  <display:column property="phoneNumber" title="Telephone"/>
  <display:column property="email" title="Email" autolink="true"/>
  <display:column property="insuranceName" title="Assurance"/>
  <display:column property="insuranceNumber" title="No assure"/>
  <display:column property="formationSelected" title="Formation"/>
  <display:column property="group" title="Groupe"/>


The getstudent action serve me to get

the student an user who whant to edit him

I got an getstudentaction who create a new

studentform and populate this form with

the data of the choosen student previously


I hope this can help you.


Alexandre Jaquet

----- Original Message -----
From: "William Salvucci" <>
To: <>
Sent: Wednesday, March 05, 2003 10:14 PM
Subject: editable list using nested:iterate and lazyList

I posted this already on another thread, but I thought that I would try it
again with some more detail.

I am trying to create an editable list based on some examples using
nested:iterate and ListUtils.lazyList that I have seen offered on this
mailing list.
I have created a simple example, the flow of which is detail action ->
jsp -> control action. The form that is used by all of these looks like:

private List bananas = ListUtils.lazyList(new ArrayList(),
      new Factory()
        public Object create() {
          return new BananaBean();
  public List getBananas() { return bananas; }

The detail action adds BananaBean instances using bananas.add. Inside a
nested:form on the jsp I have

<nested:iterate property="bananas">
    <nested:text property="flavour"/>

and in the control action, I do form.getBananas() and print out the values
to see if they reflect the changes I made on the page.

I can't even successfully display the jsp. I get the following exception:
java.lang.IllegalArgumentException: Property 'bananas' is not indexed

I can't think of a simplier example. Any ideas?

I'm using nested_tags_10.jar with 1.3.1

BTW: LazyList implements Collection so it's indexed, right?

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message