Hi, I didn't get any trouble with the sample I show, It's was just to help somebody.
-- Alexandre Jaquet ----- Original Message ----- From: "Arron Bates" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Thursday, March 06, 2003 11:45 PM Subject: Re: editable list using nested:iterate and lazyList > Alex, > > The JSP wasn't shown probably because it's like all other Struts table > creation using the iterate tag. Example JSP... > > <table> > <nested:iterate property="studentList"> > <tr> > <td><nested:text property="studentId" /></td> > <td><nested:text property="firstName" /></td> > <td><nested:text property="lastName" /></td> > </tr> > </nested:iterate> > </table> > > ...when submitted, if you're "student bean" is in a LazyList, then it'll > populate correctly, and all the data will be there for your action for processing. > > This what you're after?... > > > Arron. > > (Monkey Boy?...) > > > > Is this an example of an editable list (ie. a table like structure)? Based > on your student example, I am trying to edit a list of students all on one > page. ie. I could change five students names with one submit. > > Maybe I didn't fully understand your example, but it sounds like your > example is list/detail page setup where one page has a list (non editable) and > from that list page you can select a single student which is displayed in a > detail page from which you can edit that one student's info. > > > > I am using a LazyList because the only example of an editable list that I > have every seen was given by Arron Bates (monkey boy) and that is what he did, > but he did not show how the jsp page was done. > > > > >>> [EMAIL PROTECTED] 03/05/03 05:11PM >>> > > 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, > > org.apache.taglibs.display.test.ListHolder, > > java.util.List"%> > > <%@ taglib uri="http://jakarta.apache.org/taglibs/display" prefix="display" > > %> > > <%@ taglib uri="/WEB-INF/struts-menu.tld" prefix="menu"%> > > > > <html> > > <head> > > </head> > > > > <body> > > <script language="JavaScript1.2" src="./scripts/coolmenus3.js"> > > </script> > > <script src="./scripts/coolmenu-config.js"> > > </script> > > > > <menu:useMenuDisplayer name="CoolMenu" > > > > bundle="org.apache.struts.action.MESSAGE"> > > > > <menu:displayMenu name="ToDoListMenuFile"/> > > <menu:displayMenu name="ToDoListMenuEdit"/> > > <menu:displayMenu name="CaseDetailMenuCase"/> > > </menu:useMenuDisplayer> > > <p> > > <p> </p> > > <p> </p> > > <p> </p> > > <p> </p> > > <p> </p> > > <p> </p> > > > > <display:table width="85%"align="left" > > name="students" > > scope="session" > > pagesize="5" > > requestURI="/ibmss/form/viewstudent.jsp" > > export="true" > > decorator="org.apache.taglibs.display.test.Wrapper"> > > > > <display:column property="idPersonne" title="ID" > > href="/ibmss/getstudent.do" > > paramId="idPersonne" > > paramProperty="idPersonne" /> > > <display:column property="name" title="Nom"/> > > <display:column property="firstName" title="Prinom"/> > > <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"/> > > </display:table> > > > > </body> > > </html> > > > > 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 > > > > selected. > > > > I hope this can help you. > > > > -- > > > > Alexandre Jaquet > > > > ----- Original Message ----- > > From: "William Salvucci" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > 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"/> > > </nested:iterate> > > > > 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: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]