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].nameinput 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]
RE: Changing position of nested beans
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].nameinput 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.
Re: Changing position of nested beans
Can you elaborate? I'd have several indexed properties in my form, how would i know which to extract? On 11 Mar 2004, at 10:43, VAN BROECK Jimmy wrote: 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].nameinput 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. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Changing position of nested beans
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].nameinput 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]
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].nameinput 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]
Re: Changing position of nested beans
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].nameinput 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
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].nameinput 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] - 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]
Re: Changing position of nested beans
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].nameinput 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]
RE: Changing position of nested beans
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].nameinput 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
Re: Changing position of nested beans
The radio button could just be the boy.. Nice one Hubert On 11 Mar 2004, at 18:28, Hubert Rabago wrote: 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].nameinput 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