It's never enough FOR YOU PEOPLE!!! =^D public static Collection<? extends Thing> getThings() { ArrayList<Thing> things = new ArrayList<Thing>(); things.add(new Thing(1, "foo", 1.95f)); return things; }
<action name="mapBackedUI*" method="{1}" class="acme.action.ListAction"> <result> displayTile-{1} </result> </action> mgainty wrote: > > > code for addAll? > code for Thing.getThings()? > struts.xml action config for mapBackedUIsaveList? > > thanks, > Martin > ______________________________________________ > Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité > > Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene > Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte > Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht > dient lediglich dem Austausch von Informationen und entfaltet keine > rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von > E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. > Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le > destinataire prévu, nous te demandons avec bonté que pour satisfaire > informez l'expéditeur. N'importe quelle diffusion non autorisée ou la > copie de ceci est interdite. Ce message sert à l'information seulement et > n'aura pas n'importe quel effet légalement obligatoire. Étant donné que > les email peuvent facilement être sujets à la manipulation, nous ne > pouvons accepter aucune responsabilité pour le contenu fourni. > > > > >> Date: Tue, 16 Jun 2009 09:10:10 -0700 >> From: stanl...@gmail.com >> To: user@struts.apache.org >> Subject: Mapped back UI and #status.index driven names >> >> >> How is that for a subject line? I always wonder what I would search for >> myself :working: >> >> I had a guy tell me that a struts web tag was generating an absurd number >> of >> method calls on his action/model. After carefully considering his >> scenario, >> I was able to experiment using the files below. When the page is loaded >> a >> single call is made to the getThings() which returns one instance of >> Thing. >> However, when the submit is clicked, the getThings() is called 33 times! >> Before I bury my head in code, can anyone see why this might be the case? >> The Parameters interceptor is in the stack one time and the generated >> HTML >> is generating this single parameter: >> >> <input type="text" name="things[0].name" value="foo" >> id="mapBackedUIsaveList_things_0__name"/> >> >> >> >> Action: >> >> public class ListAction extends BaseAction { >> >> private static List<Thing> things; >> public List<Thing> getThings() { >> if (things == null) { >> things = new ArrayList(); >> things.addAll(Thing.getThings()); >> } >> return things; >> } >> >> public void setThings(List<Thing> things) { >> this.things = things; >> } >> public String list() throws Exception { >> return SUCCESS; >> } >> public String saveList() throws Exception { >> return SUCCESS; >> } >> } >> >> Page: >> >> <s:form action="mapBackedUIsaveList"> >> <table> >> <tr> >> <td> >> Name >> </td> >> </tr> >> <s:iterator value="things" status="status"> >> <tr> >> <td> >> >> </td> >> <td> >> <s:textfield >> name="things[%{#status.index}].name" >> value="%{name}" /> >> </td> >> <td> >> >> </td> >> </tr> >> </s:iterator> >> </table> >> <s:submit /> >> </s:form> >> >> Bean: >> >> public class Thing { >> >> private String name; >> >> get/set >> >> } >> -- >> View this message in context: >> http://www.nabble.com/Mapped-back-UI-and--status.index-driven-names-tp24057659p24057659.html >> Sent from the Struts - User mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> > > _________________________________________________________________ > Microsoft brings you a new way to search the web. Try Bing™ now > http://www.bing.com?form=MFEHPG&publ=WLHMTAG&crea=TEXT_MFEHPG_Core_tagline_try > bing_1x1 > -- View this message in context: http://www.nabble.com/Mapped-back-UI-and--status.index-driven-names-tp24057659p24058089.html Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org