Not sure if you're looking different ways to do Move Up/Move Down or just a
way to make your "one button for each item" work.  If it's the former, you
can include a radio button beside each item and have one Move Up and one Move
Down button for the whole form.  The radio button will have the index of the
item it's sitting next to.  When a Move button is pressed, you'll have one
non-indexed field containing the index of the item to either move up or down,
and you can react appropriately.  Hmm... the question is, how do you get the
value of <logic:iterate>'s indexId to the value of your <html:radio> without
using <%= %>?  Could I have been on the crack, too, and not know it?

Hubert


-----Original Message-----
From: Mark Lowe [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 11, 2004 10:05 AM
To: Struts Users Mailing List
Subject: Re: Changing position of nested beans


Crack smoking gags aside..

I've tried hacking around the problem using the unspecified method to  
no avail. Looks like storing in session and using links.

Unless I have any sudden rushes of blood to the head.

On 11 Mar 2004, at 13:21, Niall Pemberton wrote:

> You know before I read you messages, I would have understood "crack" 
> programmer as a compliment - now I'm thinking it could be a support
> group
> for those of us who spend too much time on lists like this :-).
>
>
> ----- Original Message -----
> From: "Mark Lowe" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Thursday, March 11, 2004 11:51 AM
> Subject: Re: Changing position of nested beans
>
>
>> The only reason why dispatch action appeals is that i can map the 
>> form to one action and have several buttons within a form without needing
>> to
>> change to form action with javascript or anything grotty like that.
>>
>> I'm not especially keen dispatch actions . Just this business of 
>> using links and the request being cleared leaves me scoping to 
>> session and using a link, again i'm not that against scoping to 
>> session but I thought someone in the anti httpsession brigade would 
>> have a solution for this common problem.
>>
>> I don't think I'm tree-barking but ruminating on dispatch action 
>> (although i'm not certain).
>>
>> I'm trying various ways and seeing what happens. But indexed handler 
>> parameters seem like the sort of thing that would be required to do 
>> such a thing, but seem to be more the consequence of a crack induced 
>> state of derangement than something that struts supports.
>>
>>
>> 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.
>>>>
>>>>


__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster
http://search.yahoo.com

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

Reply via email to