Lots of people have done it. Search the archives [1]. Search for "indexed" and "lazyList". I've done it with both ActionForm and DynaActionForm. Hubert [1] http://struts.apache.org/mail.html On 11/17/06, Adam K wrote: > I think I have found the problem - or at least a potential cause. Would it > be correct in stating that this will not work using ActionForm (what I was > using) and that I must instead use DynaActionForm ? > > Thanks for the time thus far. > > > On 11/17/06, Hubert Rabago wrote: > > > > Adam, > > > > Try adding a getResultsPage() that doesn't take params and always > > returns a valid collection. (Throw in the setResultsPage() that > > accepts a collection as well.) > > > > Hubert > > > > On 11/17/06, Adam K wrote: > > > This has been driving me nuts for the past little bit. > > > I have a page that is populated using indexed properties. The > > prepopulation > > > works fine, and I get the results as I would expect them, but trying to > > > submit the form I get an index out of bounds exception. I know that it > > is > > > being caused because the page doesn't have the arrayList to use in the > > > indexed properties. I guess my question boils down to using indexed > > > properties properly. I will start by putting in an explanation of what > > I > > > have and what I am trying to do: > > > > > > The following is what I am working with : > > > JSP: > > > > > > > > > > > id="ResultsPage"> > > > > > > > property="description" > > > /> > > > > property="numProducts" > > > indexed="true" /> > > > > > > > > > > > > > > > What I am trying to achieve is that a user clicks on a link, they are > > sent > > > to page, and all of the values are prepopulated. The page is then > > displayed > > > and the user has the option to modify any of the variables that they > > want to > > > before resubmitting the page. (When they resubmit the form has a url > > > parameter attached to it). What is happening (or at least what I > > believe is > > > happening is the following: link is clicked, reset is called action > > sets > > > the variables, page is displayed, user can modify the page and resubmit, > > > reset is called on the form, the action is called (this is where it dies > > as > > > there is no longer an ArrayList) to modify. My question is am I going > > about > > > this in a manner that seems sensible or am I way off base ? I have the > > > values being prepopulated, but when trying to use the values that the > > user > > > puts in I can't use them in the action, nor can I pull the values from > > the > > > form without again setting the values in the form. I am hoping it is > > that > > > I have over looked something, but it's possible that I don't understand > > > something as well. > > > > > > Here is the Action code (This is the entire execute method) : > > > HttpSession session = request.getSession(); > > > ProdSelectionForm prodSelection = (ProdSelectionForm) form; > > > User user ; > > > user = (User)session.getAttribute("User"); > > > Order order = new Order(); > > > ArrayList products = new ArrayList(); > > > ArrayList pageRes = new ArrayList(); > > > ArrayList results = new ArrayList(); > > > > > > String action = (request.getParameter("Dest") == null ? > > "populate" : > > > request.getParameter("Dest") ); > > > > > > order = user.getCurrOrder(user); > > > > > > if(action.equals("populate")) > > > { > > > prodSelection.setResults(order.getProducts()); > > > } > > > > > > if(action.equals("Delete")) > > > { > > > ArrayList p = new ArrayList(); > > > p = prodSelection.getResults(); > > > > > > int count = 0; > > > while (count < p.size()) > > > { > > > Product t = (Product) p.get(count); > > > t.setDescription("" +t.getNumProducts() +">" > > +pageRes.size() > > > +"<"); > > > p.set(count, t); > > > count++; > > > } > > > > > > t.setDescription("" +t.getNumProducts() +">" +p.size() > > +"<"); > > > p.set(0, t); > > > > > > user.setOrder(p , user); > > > prodSelection.setResults(p); > > > prodSelection.setTest(prodSelection.getTest()+" + " + p.size > > ()); > > > > > > return mapping.findForward("success"); > > > } > > > return mapping.findForward("success"); > > > > > > > > > > > > > > > Form code: (In the form code is an ArrayList called results. This > > arraylist > > > contains a bunch of Product ) > > > > > > public Product getResultsPage(int index) > > > { > > > if(this.results == null) > > > { > > > this.results = new ArrayList(); > > > } > > > > > > while(index >= this.results.size()) > > > { > > > this.results.add(new Product()); > > > } > > > return (Product) results.get(index); > > > } > > > > > > public void setResultsPage(int index, Product p) > > > { > > > if(this.results == null) > > > { > > > this.results = new ArrayList(); > > > } > > > > > > while(index >= this.results.size()) > > > { > > > this.results.add(new Product()); > > > } > > > results.set(index, p); > > > //return (Product) results.get(index); > > > } > > > > > > public void setResults(ArrayList results) > > > { > > > this.results=results; > > > } > > > > > > public ArrayList getResults() > > > { > > > return this.results; > > > } > > > > > > > > > > > > Products is an object that stores various things about a product with > > > numProducts, and description being two of those things. > > > Within Products is both getter and setter methods for the numProducts as > > > well as description. > > > > > > > > > > > > Thanks so much for any help you may be able to provide. > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org > > For additional commands, e-mail: user-help@struts.apache.org > > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional commands, e-mail: user-help@struts.apache.org