RE: SuccessAction (was RE: Addition of two new actions)
I thought the whole point was that there would be only one forward and the action would always forward to that forward? In that case, you could count on using the first one. Just thinking that if an anonymous/default ActionForward were allowed, then it could also be useful for other actions. In any case, it's better not to allow a situation where the behaviour is unspecified. You'd probably need to add a method such as getDefaultForward() to retrieve it. This part seems to be adding complexity to something which was meant to be very simple. I think it might actually be possible to reduce the visible complexity by doing that. e.g. action path=/myAction type=org.apache.struts.actions.SuccessAction forward path=/myPage.jsp/ /action SuccessAction may not now be best name, but let's stick with it for the moment. To be really radical, we could absorb the behaviour into Action, and have it check for a default ActionForward and use that, if found. That way there's no need for a SuccessAction at all. Then you could just do: action path=/myAction type=org.apache.struts.action.Action forward path=/myPage.jsp/ /action If Action actually does something useful, could we go crazy and default the type as well? action path=/myAction forward path=/myPage.jsp/ /action Now that's simple. Especially if you allow a global default forward... action path=/myAction/ Probably not quite so useful, but nicely minimal! Steve - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RE: SuccessAction (was RE: Addition of two new actions)
ÔÚ 2003-08-08 21:15:00 ÄúдµÀ£º I've created some patches to try this out and attached them to Bugzilla.of you ? Could you tell me ? Thanks~~ http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22267 Sorry about the multiple patch files, but WS Studio wouldn't play ball. I haven't touched Action...yet ;-) Steve -Original Message- From: Steve Raeburn [mailto:[EMAIL PROTECTED] Sent: August 8, 2003 8:36 PM To: Struts Developers List Subject: RE: SuccessAction (was RE: Addition of two new actions) I thought the whole point was that there would be only one forward and the action would always forward to that forward? In that case, you could count on using the first one. Just thinking that if an anonymous/default ActionForward were allowed, then it could also be useful for other actions. In any case, it's better not to allow a situation where the behaviour is unspecified. You'd probably need to add a method such as getDefaultForward() to retrieve it. This part seems to be adding complexity to something which was meant to be very simple. I think it might actually be possible to reduce the visible complexity by doing that. e.g. action path=/myAction type=org.apache.struts.actions.SuccessAction forward path=/myPage.jsp/ /action SuccessAction may not now be best name, but let's stick with it for the moment. To be really radical, we could absorb the behaviour into Action, and have it check for a default ActionForward and use that, if found. That way there's no need for a SuccessAction at all. Then you could just do: action path=/myAction type=org.apache.struts.action.Action forward path=/myPage.jsp/ /action If Action actually does something useful, could we go crazy and default the type as well? action path=/myAction forward path=/myPage.jsp/ /action Now that's simple. Especially if you allow a global default forward... action path=/myAction/ Probably not quite so useful, but nicely minimal! Steve - 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] mqg - SOUVENIR --- . | Souvenir of China | | A Good Place for You | `-- http://www.souvenirchina.com -' mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RE: SuccessAction (was RE: Addition of two new actions)
ÔÚ 2003-08-08 21:15:00 ÄúдµÀ£º I've created some patches to try this out and attached them to Bugzilla.of you ? Could you tell me ? Thanks~~ http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22267 Sorry about the multiple patch files, but WS Studio wouldn't play ball. I haven't touched Action...yet ;-) Steve -Original Message- From: Steve Raeburn [mailto:[EMAIL PROTECTED] Sent: August 8, 2003 8:36 PM To: Struts Developers List Subject: RE: SuccessAction (was RE: Addition of two new actions) I thought the whole point was that there would be only one forward and the action would always forward to that forward? In that case, you could count on using the first one. Just thinking that if an anonymous/default ActionForward were allowed, then it could also be useful for other actions. In any case, it's better not to allow a situation where the behaviour is unspecified. You'd probably need to add a method such as getDefaultForward() to retrieve it. This part seems to be adding complexity to something which was meant to be very simple. I think it might actually be possible to reduce the visible complexity by doing that. e.g. action path=/myAction type=org.apache.struts.actions.SuccessAction forward path=/myPage.jsp/ /action SuccessAction may not now be best name, but let's stick with it for the moment. To be really radical, we could absorb the behaviour into Action, and have it check for a default ActionForward and use that, if found. That way there's no need for a SuccessAction at all. Then you could just do: action path=/myAction type=org.apache.struts.action.Action forward path=/myPage.jsp/ /action If Action actually does something useful, could we go crazy and default the type as well? action path=/myAction forward path=/myPage.jsp/ /action Now that's simple. Especially if you allow a global default forward... action path=/myAction/ Probably not quite so useful, but nicely minimal! Steve - 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] mqg - SOUVENIR --- . | Souvenir of China | | A Good Place for You | `-- http://www.souvenirchina.com -' mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: SuccessAction (was RE: Addition of two new actions)
--- Steve Raeburn [EMAIL PROTECTED] wrote: OK, I'm back. Now where were we... What you're suggesting is this? action path=/myAction type=o.a.s.actions.SuccessAction forward name=success path=/myPage.jsp /action action path=/myOtherAction type=o.a.s.actions.SuccessAction parameter=oops forward name=oops path=/myPage.jsp /action I honestly don't see the value in the second method. You've just added a parameter to tell the action which forward to select when there is only one possible choice. You've also got two actions which do exactly the same thing, but are configured differently. That's a good point which raises another question. If the goal of SuccessAction is to forward to the one defined forward instance, why must we name it success or oops? Why can't SuccessAction call mapping.findForwards() and return the first forward it finds? Then we don't need to use the parameter attribute nor do we need to declare that success is the one right name for the forward. However, that makes SuccessAction a bit silly. If it's just going to forward to the first forward it finds, why not change the way we define forwards to be more natural and flexible? What I think we're seeing here is that we've outgrown our ActionForward declarations and need some new ones. I'm fine with adding a SuccessAction but would really like to see us discuss future possibilities in this area. My concern is that adding the parameter makes the use of the action a little less of a no-brainer (sometimes a *little* more complexity is all it takes). In its proposed default state SuccessAction would still be a complete no-brainer. I would be grateful if you could give an illustration of an example where success couldn't be used. Most other actions can be identified as having a success or fail outcome (or something in between). To my mind this is an action where the only possible outcome is success, so I can't see why the name would cause you so much trouble. Even if you're forwarding to an error page, the *action* is still successful. I've never said that success is a poor term or isn't used in most cases. I just don't think Struts should dictate the names of forwards to users. That is there choice and should be configurable. We all know that Action chaining isn't generally a smart move but sometimes it works out ok. Consider a RegisterAction that forwards to a LoginAction to login a user immediately after they register. RegisterAction might want to name its success forward login. Admittedly, this isn't directly applicable to our SuccessAction situation but it does show that success isn't *always* the correct term. Also, not every Struts developer speaks english and may choose forward names in their native language. Please reconsider whether having the flexibility of adding the parameter is really necessary. I think that in the vast majority of cases it isn't and for the minority a custom action would be an option. However, if you're *really* set on having the parameter option then let's go with SuccessAction, with the forward name being supplied by the parameter and defaulting to success if none is supplied. Ok? But, only if you really, really, really insist ;-) I'd like to get your thoughts (and others) on my proposal at the beginning of this message. In short, we wouldn't use the parameter attribute nor would we define success as the only correct forward name. SuccessAction would forward to the first forward that's defined for it. I believe SuccessAction fills a current gap but is probably a temporary solution until we have a more unified/flexible forward declaration syntax. How temporary it is depends on how motivated we are to change it :-). David Steve -Original Message- From: David Graham [mailto:[EMAIL PROTECTED] Sent: August 5, 2003 6:52 AM To: Struts Developers List Subject: RE: Addition of two new actions --- Steve Raeburn [EMAIL PROTECTED] wrote: This is not a general purpose action. IMO, limited use inflexible actions don't belong in the Struts distro. We should provide common actions to ease development but they should be configurable to the user's needs. It is intended to do just one thing and that's forward the request to one place. My suggestion doesn't change that. There is deliberately no flexibility in the action. The flexibility comes from being able to use an ActionFoward definition. We wouldn't be dictating anything because you always have the option of creating a custom action. However, if you want to do this right now then Struts *requires* that you create your own action. To enable naming the foward via parameter would IMHO be generalising at the expense of usability. Please elaborate on this. I don't see any drawbacks to allowing people the freedom of defining what forward the action
RE: SuccessAction (was RE: Addition of two new actions)
-Original Message- From: David Graham [mailto:[EMAIL PROTECTED] Sent: August 9, 2003 3:56 PM To: Struts Developers List Subject: RE: SuccessAction (was RE: Addition of two new actions) If Action actually does something useful, could we go crazy and default the type as well? action path=/myAction forward path=/myPage.jsp/ /action There is a simpler way of doing that: action path=/myAction forward=/myPage.jsp/ The only benefit of SuccessAction was that it allowed you to use the more configurable forward element to describe the forward so I think SuccessAction examples should include forward attributes that couldn't be done any other way. Having said all that, I do like that we're trying to get a simpler action/forward declaration syntax :-). But forward= doesn't allow you to mix 'n' match context/module relative forwards :-) Now that's simple. Especially if you allow a global default forward... action path=/myAction/ All we know from this is that there is an action mapped to /myAction but we don't know what handles it. Taken by itself, it looks nonsensical and would likely cause confusion. This may be a case where it's *too* simple. David I wasn't being entirely serious with that, just following it to its logical conclusion. I did say it probably wasn't very useful. But it would work. If you know that you can define a global default forward then it makes sense. It does raise the question of whether we want to allow/look for a global default action. I'm thinking it may be better to insist that each global forward has a name, just to avoid confusion. Technically, it works but it might just be too confusing. Steve. Probably not quite so useful, but nicely minimal! Steve - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - 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: SuccessAction (was RE: Addition of two new actions)
At 18:18 -0700 8/8/03, Steve Raeburn wrote: I don't think that you could rely on the ActionForwards being returned in the same order each time, so forwarding to the first one found would not be guaranteed to work. I thought the whole point was that there would be only one forward and the action would always forward to that forward? In that case, you could count on using the first one. If order was deemed meaningful, it would be easy enough to use the SequencedHashMap from Commons Collections. Any forward without a name, would be stored under a default key (defined in Globals). You could use null here, but I think it would be better to use an actual value. You'd probably need to add a method such as getDefaultForward() to retrieve it. This part seems to be adding complexity to something which was meant to be very simple. To be fair, I'm just kibitzing; I dropped off this thread a while back and don't have very strong feelings either way. Joe -- -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com If nature worked that way, the universe would crash all the time. --Jaron Lanier - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RE: SuccessAction (was RE: Addition of two new actions)
hi ,all: how can I send my questions to all of you ? Could you tell me ? Thanks~~ mqg - SOUVENIR --- . | Souvenir of China | | A Good Place for You | `-- http://www.souvenirchina.com -' mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: SuccessAction (was RE: Addition of two new actions)
--- Steve Raeburn [EMAIL PROTECTED] wrote: I thought the whole point was that there would be only one forward and the action would always forward to that forward? In that case, you could count on using the first one. Just thinking that if an anonymous/default ActionForward were allowed, then it could also be useful for other actions. In any case, it's better not to allow a situation where the behaviour is unspecified. You'd probably need to add a method such as getDefaultForward() to retrieve it. This part seems to be adding complexity to something which was meant to be very simple. I think it might actually be possible to reduce the visible complexity by doing that. e.g. action path=/myAction type=org.apache.struts.actions.SuccessAction forward path=/myPage.jsp/ /action SuccessAction may not now be best name, but let's stick with it for the moment. To be really radical, we could absorb the behaviour into Action, and have it check for a default ActionForward and use that, if found. That way there's no need for a SuccessAction at all. Then you could just do: action path=/myAction type=org.apache.struts.action.Action forward path=/myPage.jsp/ /action If Action actually does something useful, could we go crazy and default the type as well? action path=/myAction forward path=/myPage.jsp/ /action There is a simpler way of doing that: action path=/myAction forward=/myPage.jsp/ The only benefit of SuccessAction was that it allowed you to use the more configurable forward element to describe the forward so I think SuccessAction examples should include forward attributes that couldn't be done any other way. Having said all that, I do like that we're trying to get a simpler action/forward declaration syntax :-). Now that's simple. Especially if you allow a global default forward... action path=/myAction/ All we know from this is that there is an action mapped to /myAction but we don't know what handles it. Taken by itself, it looks nonsensical and would likely cause confusion. This may be a case where it's *too* simple. David Probably not quite so useful, but nicely minimal! Steve - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RE: SuccessAction (was RE: Addition of two new actions)
hi ,all: how can I send my questions to all of you ? Could you tell me ? Thanks~~ mqg - SOUVENIR --- . | Souvenir of China | | A Good Place for You | `-- http://www.souvenirchina.com -' mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RE: SuccessAction (was RE: Addition of two new actions)
ÔÚ 2003-08-08 21:15:00 ÄúдµÀ£º I've created some patches to try this out and attached them to Bugzilla.of you ? Could you tell me ? Thanks~~ http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22267 Sorry about the multiple patch files, but WS Studio wouldn't play ball. I haven't touched Action...yet ;-) Steve -Original Message- From: Steve Raeburn [mailto:[EMAIL PROTECTED] Sent: August 8, 2003 8:36 PM To: Struts Developers List Subject: RE: SuccessAction (was RE: Addition of two new actions) I thought the whole point was that there would be only one forward and the action would always forward to that forward? In that case, you could count on using the first one. Just thinking that if an anonymous/default ActionForward were allowed, then it could also be useful for other actions. In any case, it's better not to allow a situation where the behaviour is unspecified. You'd probably need to add a method such as getDefaultForward() to retrieve it. This part seems to be adding complexity to something which was meant to be very simple. I think it might actually be possible to reduce the visible complexity by doing that. e.g. action path=/myAction type=org.apache.struts.actions.SuccessAction forward path=/myPage.jsp/ /action SuccessAction may not now be best name, but let's stick with it for the moment. To be really radical, we could absorb the behaviour into Action, and have it check for a default ActionForward and use that, if found. That way there's no need for a SuccessAction at all. Then you could just do: action path=/myAction type=org.apache.struts.action.Action forward path=/myPage.jsp/ /action If Action actually does something useful, could we go crazy and default the type as well? action path=/myAction forward path=/myPage.jsp/ /action Now that's simple. Especially if you allow a global default forward... action path=/myAction/ Probably not quite so useful, but nicely minimal! Steve - 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] mqg - SOUVENIR --- . | Souvenir of China | | A Good Place for You | `-- http://www.souvenirchina.com -' mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RE: SuccessAction (was RE: Addition of two new actions)
ÔÚ 2003-08-08 21:15:00 ÄúдµÀ£º I've created some patches to try this out and attached them to Bugzilla.of you ? Could you tell me ? Thanks~~ http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22267 Sorry about the multiple patch files, but WS Studio wouldn't play ball. I haven't touched Action...yet ;-) Steve -Original Message- From: Steve Raeburn [mailto:[EMAIL PROTECTED] Sent: August 8, 2003 8:36 PM To: Struts Developers List Subject: RE: SuccessAction (was RE: Addition of two new actions) I thought the whole point was that there would be only one forward and the action would always forward to that forward? In that case, you could count on using the first one. Just thinking that if an anonymous/default ActionForward were allowed, then it could also be useful for other actions. In any case, it's better not to allow a situation where the behaviour is unspecified. You'd probably need to add a method such as getDefaultForward() to retrieve it. This part seems to be adding complexity to something which was meant to be very simple. I think it might actually be possible to reduce the visible complexity by doing that. e.g. action path=/myAction type=org.apache.struts.actions.SuccessAction forward path=/myPage.jsp/ /action SuccessAction may not now be best name, but let's stick with it for the moment. To be really radical, we could absorb the behaviour into Action, and have it check for a default ActionForward and use that, if found. That way there's no need for a SuccessAction at all. Then you could just do: action path=/myAction type=org.apache.struts.action.Action forward path=/myPage.jsp/ /action If Action actually does something useful, could we go crazy and default the type as well? action path=/myAction forward path=/myPage.jsp/ /action Now that's simple. Especially if you allow a global default forward... action path=/myAction/ Probably not quite so useful, but nicely minimal! Steve - 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] mqg - SOUVENIR --- . | Souvenir of China | | A Good Place for You | `-- http://www.souvenirchina.com -' mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RE: SuccessAction (was RE: Addition of two new actions)
ÔÚ 2003-08-08 21:15:00 ÄúдµÀ£º I've created some patches to try this out and attached them to Bugzilla.of you ? Could you tell me ? Thanks~~ http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22267 Sorry about the multiple patch files, but WS Studio wouldn't play ball. I haven't touched Action...yet ;-) Steve -Original Message- From: Steve Raeburn [mailto:[EMAIL PROTECTED] Sent: August 8, 2003 8:36 PM To: Struts Developers List Subject: RE: SuccessAction (was RE: Addition of two new actions) I thought the whole point was that there would be only one forward and the action would always forward to that forward? In that case, you could count on using the first one. Just thinking that if an anonymous/default ActionForward were allowed, then it could also be useful for other actions. In any case, it's better not to allow a situation where the behaviour is unspecified. You'd probably need to add a method such as getDefaultForward() to retrieve it. This part seems to be adding complexity to something which was meant to be very simple. I think it might actually be possible to reduce the visible complexity by doing that. e.g. action path=/myAction type=org.apache.struts.actions.SuccessAction forward path=/myPage.jsp/ /action SuccessAction may not now be best name, but let's stick with it for the moment. To be really radical, we could absorb the behaviour into Action, and have it check for a default ActionForward and use that, if found. That way there's no need for a SuccessAction at all. Then you could just do: action path=/myAction type=org.apache.struts.action.Action forward path=/myPage.jsp/ /action If Action actually does something useful, could we go crazy and default the type as well? action path=/myAction forward path=/myPage.jsp/ /action Now that's simple. Especially if you allow a global default forward... action path=/myAction/ Probably not quite so useful, but nicely minimal! Steve - 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] mqg - SOUVENIR --- . | Souvenir of China | | A Good Place for You | `-- http://www.souvenirchina.com -' mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: SuccessAction (was RE: Addition of two new actions)
I've created some patches to try this out and attached them to Bugzilla. http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22267 Sorry about the multiple patch files, but WS Studio wouldn't play ball. I haven't touched Action...yet ;-) Steve -Original Message- From: Steve Raeburn [mailto:[EMAIL PROTECTED] Sent: August 8, 2003 8:36 PM To: Struts Developers List Subject: RE: SuccessAction (was RE: Addition of two new actions) I thought the whole point was that there would be only one forward and the action would always forward to that forward? In that case, you could count on using the first one. Just thinking that if an anonymous/default ActionForward were allowed, then it could also be useful for other actions. In any case, it's better not to allow a situation where the behaviour is unspecified. You'd probably need to add a method such as getDefaultForward() to retrieve it. This part seems to be adding complexity to something which was meant to be very simple. I think it might actually be possible to reduce the visible complexity by doing that. e.g. action path=/myAction type=org.apache.struts.actions.SuccessAction forward path=/myPage.jsp/ /action SuccessAction may not now be best name, but let's stick with it for the moment. To be really radical, we could absorb the behaviour into Action, and have it check for a default ActionForward and use that, if found. That way there's no need for a SuccessAction at all. Then you could just do: action path=/myAction type=org.apache.struts.action.Action forward path=/myPage.jsp/ /action If Action actually does something useful, could we go crazy and default the type as well? action path=/myAction forward path=/myPage.jsp/ /action Now that's simple. Especially if you allow a global default forward... action path=/myAction/ Probably not quite so useful, but nicely minimal! Steve - 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: SuccessAction (was RE: Addition of two new actions)
Maverick directly supports the idea that a command may have only one destrintation, and then streamlines its behavior. So we have some precedent under the great minds theory =:0) ActionMapping.findForwards only brings back local forwards. So the DefaultAction could just forward to the first and only local forward, and perhaps throw an exception if there were not exactly one. Something like String[] forwards = mapping.findForwards(); if (1!=forwards.length) { throw new RuntimeException(DefaultAction: Exactly one forward must be specified); } return mapping.findForward(forwards[0]); -Ted. Joe Germuska wrote: At 16:51 -0700 8/8/03, David Graham wrote: I'd like to get your thoughts (and others) on my proposal at the beginning of this message. In short, we wouldn't use the parameter attribute nor would we define success as the only correct forward name. SuccessAction would forward to the first forward that's defined for it. This sounds like a great compromise, seeing as it would be totally compatible with naming the forwards success, as well as anything else. ( I tend to use page in the analogous case). Joe -- Ted Husted, Junit in Action - http://www.manning.com/massol/, Struts in Action - http://husted.com/struts/book.html, JSP Site Design - http://www.amazon.com/exec/obidos/ISBN=1861005512. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: SuccessAction (was RE: Addition of two new actions)
At 16:51 -0700 8/8/03, David Graham wrote: I'd like to get your thoughts (and others) on my proposal at the beginning of this message. In short, we wouldn't use the parameter attribute nor would we define success as the only correct forward name. SuccessAction would forward to the first forward that's defined for it. This sounds like a great compromise, seeing as it would be totally compatible with naming the forwards success, as well as anything else. ( I tend to use page in the analogous case). Joe -- -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com If nature worked that way, the universe would crash all the time. --Jaron Lanier - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: SuccessAction (was RE: Addition of two new actions)
I don't think that you could rely on the ActionForwards being returned in the same order each time, so forwarding to the first one found would not be guaranteed to work. If we allowed anonymous or default ActionForwards would that work? action path=/myAction type=o.a.s.actions.SuccessAction forward path=/myPage.jsp /action Any forward without a name, would be stored under a default key (defined in Globals). You could use null here, but I think it would be better to use an actual value. You'd probably need to add a method such as getDefaultForward() to retrieve it. I could see this being of use in more than just SuccessAction (or equivalent). Quite often you're either forwarding to a success destination or returning to the input destination, so anonymous forwards would save a bit of work. I'll go have a play with this and see what I come up with. Steve -Original Message- From: David Graham [mailto:[EMAIL PROTECTED] Sent: August 8, 2003 4:51 PM To: Struts Developers List Subject: Re: SuccessAction (was RE: Addition of two new actions) --- Steve Raeburn [EMAIL PROTECTED] wrote: OK, I'm back. Now where were we... What you're suggesting is this? action path=/myAction type=o.a.s.actions.SuccessAction forward name=success path=/myPage.jsp /action action path=/myOtherAction type=o.a.s.actions.SuccessAction parameter=oops forward name=oops path=/myPage.jsp /action I honestly don't see the value in the second method. You've just added a parameter to tell the action which forward to select when there is only one possible choice. You've also got two actions which do exactly the same thing, but are configured differently. That's a good point which raises another question. If the goal of SuccessAction is to forward to the one defined forward instance, why must we name it success or oops? Why can't SuccessAction call mapping.findForwards() and return the first forward it finds? Then we don't need to use the parameter attribute nor do we need to declare that success is the one right name for the forward. However, that makes SuccessAction a bit silly. If it's just going to forward to the first forward it finds, why not change the way we define forwards to be more natural and flexible? What I think we're seeing here is that we've outgrown our ActionForward declarations and need some new ones. I'm fine with adding a SuccessAction but would really like to see us discuss future possibilities in this area. My concern is that adding the parameter makes the use of the action a little less of a no-brainer (sometimes a *little* more complexity is all it takes). In its proposed default state SuccessAction would still be a complete no-brainer. I would be grateful if you could give an illustration of an example where success couldn't be used. Most other actions can be identified as having a success or fail outcome (or something in between). To my mind this is an action where the only possible outcome is success, so I can't see why the name would cause you so much trouble. Even if you're forwarding to an error page, the *action* is still successful. I've never said that success is a poor term or isn't used in most cases. I just don't think Struts should dictate the names of forwards to users. That is there choice and should be configurable. We all know that Action chaining isn't generally a smart move but sometimes it works out ok. Consider a RegisterAction that forwards to a LoginAction to login a user immediately after they register. RegisterAction might want to name its success forward login. Admittedly, this isn't directly applicable to our SuccessAction situation but it does show that success isn't *always* the correct term. Also, not every Struts developer speaks english and may choose forward names in their native language. Please reconsider whether having the flexibility of adding the parameter is really necessary. I think that in the vast majority of cases it isn't and for the minority a custom action would be an option. However, if you're *really* set on having the parameter option then let's go with SuccessAction, with the forward name being supplied by the parameter and defaulting to success if none is supplied. Ok? But, only if you really, really, really insist ;-) I'd like to get your thoughts (and others) on my proposal at the beginning of this message. In short, we wouldn't use the parameter attribute nor would we define success as the only correct forward name. SuccessAction would forward to the first forward that's defined for it. I believe SuccessAction fills a current gap but is probably a temporary solution until we have a more unified/flexible forward declaration syntax. How temporary it is depends on how motivated we are to change it :-). David Steve