Niall

Okay.. Can i assume your solution involves links and scoping to session or is there something I'm missing?



On 11 Mar 2004, at 12:19, Niall Pemberton wrote:

Mark,

Seems to me you have already worked out the solution, except why do you need
a lookup dispatch action - rather than a "roll your own" - you have two
methods right - "Move Up" and "Move Down"?


Your jsp will populate a (foo?) List with either "Move Up" or "Move Down"
(depending on the button pressed) in the appropriate index position - so you
loop through them until you find a none null entry and call the appropriate
method depending on the value with the index position you're at.


trying to use look up dispatch action seems to be overly complicating things
to me.


Niall


----- Original Message ----- From: "Mark Lowe" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Thursday, March 11, 2004 9:31 AM 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]





--------------------------------------------------------------------- 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]



Reply via email to