Why don't you use a hidden field with the index number in it. So you can use that 
information in your action.

-----Original Message-----
From: Mark Lowe [mailto:[EMAIL PROTECTED]
Sent: donderdag 11 maart 2004 10:31
To: Struts Users Mailing List
Subject: Changing position of nested beans


I was wondering if anyone has found any slick, no javascript dependent 
solution to the following situation. My question in short is, is there 
a way of having an indexed dispatch action, or have i been on the crack 
again?

I have a form of nested beans which are ordered according to a position 
stored in the model. I don't do any sorting in the web tier nor do i 
want to, other than rejigging the indices of some indexed properties 
until such a time as the user is ready to save his/her changes to the 
model.

<form name="foosForm" action="/myapp/save.do">
        <input type="text" name="foo[0].name">
        <input type="text" name="foo[1].name">
        <input type="text" name="foo[2].name">
</form>

Now when i save I'll save the index as a field called position, thus 
all that's fine and dandy.

So lets say I want the use to define the position by having a move up 
and move down, but rather than using an indexed link i want to use a 
button.

I've a lookup dispatch action with a moveup method and all that jazz.

<html:form action="/save.do">
<logic:iterate id="foo" name="foosForm" property="foos">
        <html:text name="foo" property="name" indexed="true" />
        <html:submit property="method" indexed="true">
                <bean:message key="button.moveup" />
        </html:submit>
</logic:iterate>
</html:form>

So the rendered html would like like this

<form name="foosForm" action="/myapp/save.do">
        <input type="text" name="foo[0].name"><input type="submit" 
name="method[0]" value="Move Up">
//and so on
</form>

Of course if i submit this to a lookupdispatch action, its gonna call 
me a crazy fool. So i need to have some means of having an indexed map 
key in my key method map, or something to cross the same bridge i'm 
trying to cross.

Any ideas? I know i can do this in javascript which i will once i get 
things running without it, please no javascript suggestions.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



STRICTLY PERSONAL AND CONFIDENTIAL
This message may contain confidential and proprietary material for the sole use of the 
intended recipient. Any review or distribution by others is strictly prohibited. If 
you are not the intended recipient please contact the sender and delete all copies.

Ce Message est uniquement destin� aux destinataires indiqu�s et peut contenir des 
informations confidentielles. Si vous n'�tes pas le destinataire, vous ne devez pas 
r�v�ler le contenu de ce message ou en prendre copie. Si vous avez re�u ce message par 
erreur, veuillez en informer l'exp�diteur, ou La Poste imm�diatement, avant de le 
supprimer.

Dit bericht is enkel bestemd voor de aangeduide ontvangers en kan vertrouwelijke 
informatie bevatten. Als u niet de ontvanger bent, dan mag u de inhoud van dit bericht 
niet bekendmaken noch kopi�ren. Als u dit bericht per vergissing heeft ontvangen, 
gelieve er de afzender of De Post onmiddellijk van op de hoogte te brengen en het 
bericht vervolgens te verwijderen.

Reply via email to