You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Adam Hardy <ah...@cyberspaceroad.com> on 2008/06/17 17:18:00 UTC
default result name other than SUCCESS?
Hi,
is it possible to do this:
<action name="category/list"
class="repo.CategoryAction" method="list">
<result>categoryList.tile</result>
</action>
for result = "LIST" rather than "SUCCESS"? - I mean I want to use LIST as the
default when none is defined, rather than SUCCESS - I find it more intuitive for
my app.
Thanks
Adam
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: default result name other than SUCCESS?
Posted by Lukasz Lenart <lu...@googlemail.com>.
> Yes. This is pretty fundamental for interceptors, AFAIK.
>
> http://struts.apache.org/2.x/docs/writing-interceptors.html
Wow! I've been reading such page many times, but I see such note first
time ;-) Thanks to open my eyes!
Regards
--
Lukasz
http://www.lenart.org.pl/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: default result name other than SUCCESS?
Posted by Dave Newton <ne...@yahoo.com>.
--- On Wed, 6/18/08, Lukasz Lenart <lu...@googlemail.com> wrote:
> newton.dave@yahoo.com (that's me!) said:
>> The result has already been rendered after invoke() has been called.
> Are you sure?
Yes. This is pretty fundamental for interceptors, AFAIK.
http://struts.apache.org/2.x/docs/writing-interceptors.html
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: default result name other than SUCCESS?
Posted by Lukasz Lenart <lu...@googlemail.com>.
> The result has already been rendered after invoke() has been called.
Are you sure? I think it wasn't.
Regards
--
Lukasz
http://www.lenart.org.pl/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: default result name other than SUCCESS?
Posted by Gabriel Belingueres <be...@gmail.com>.
Thanks Dave!
PreResultListener is the answer.
2008/6/18, Dave Newton <ne...@yahoo.com>:
> The result has already been rendered after invoke() has been called.
>
> PreResultListener is where to look--although I don't as that would work either. I think both solutions are sub-optimal and not worth it.
>
> --- On Wed, 6/18/08, Lukasz Lenart <lu...@googlemail.com> wrote:
>
> > From: Lukasz Lenart <lu...@googlemail.com>
> > Subject: Re: default result name other than SUCCESS?
> > To: "Struts Users Mailing List" <us...@struts.apache.org>
> > Date: Wednesday, June 18, 2008, 12:48 PM
> > Hi,
> >
> > 2008/6/18 Chris Pratt <th...@gmail.com>:
> > > I'm not sure if the work-around will work.
> > Looking at the code, it
> > > doesn't appear that changing the result type after
> > the action has
> > > executed has any effect.
> >
> > Did you already implement it? Could you show the code?
> > It should be the last interceptor in the stack.
> >
> > my snippet for intrecept(ActionInvocation invocation)
> >
> > String result = invocation.invoke();
> > if (Action.SUCCESS.equals(result)) {
> > result = LIST;
> > }
> > return result;
> >
> >
> > Regards
> > --
> > Lukasz
> > http://www.lenart.org.pl/
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail:
> > user-help@struts.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: default result name other than SUCCESS?
Posted by Dave Newton <ne...@yahoo.com>.
The result has already been rendered after invoke() has been called.
PreResultListener is where to look--although I don't as that would work either. I think both solutions are sub-optimal and not worth it.
--- On Wed, 6/18/08, Lukasz Lenart <lu...@googlemail.com> wrote:
> From: Lukasz Lenart <lu...@googlemail.com>
> Subject: Re: default result name other than SUCCESS?
> To: "Struts Users Mailing List" <us...@struts.apache.org>
> Date: Wednesday, June 18, 2008, 12:48 PM
> Hi,
>
> 2008/6/18 Chris Pratt <th...@gmail.com>:
> > I'm not sure if the work-around will work.
> Looking at the code, it
> > doesn't appear that changing the result type after
> the action has
> > executed has any effect.
>
> Did you already implement it? Could you show the code?
> It should be the last interceptor in the stack.
>
> my snippet for intrecept(ActionInvocation invocation)
>
> String result = invocation.invoke();
> if (Action.SUCCESS.equals(result)) {
> result = LIST;
> }
> return result;
>
>
> Regards
> --
> Lukasz
> http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: default result name other than SUCCESS?
Posted by Lukasz Lenart <lu...@googlemail.com>.
Hi,
2008/6/18 Chris Pratt <th...@gmail.com>:
> I'm not sure if the work-around will work. Looking at the code, it
> doesn't appear that changing the result type after the action has
> executed has any effect.
Did you already implement it? Could you show the code?
It should be the last interceptor in the stack.
my snippet for intrecept(ActionInvocation invocation)
String result = invocation.invoke();
if (Action.SUCCESS.equals(result)) {
result = LIST;
}
return result;
Regards
--
Lukasz
http://www.lenart.org.pl/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: default result name other than SUCCESS?
Posted by Chris Pratt <th...@gmail.com>.
I'm not sure if the work-around will work. Looking at the code, it
doesn't appear that changing the result type after the action has
executed has any effect.
(*Chris*)
On Wed, Jun 18, 2008 at 6:51 AM, Adam Hardy
<ah...@cyberspaceroad.com> wrote:
> I guessed it's not modifiable but I figured I'd ask to make sure.
>
> I like the work-around, hadn't thought of it. I'd probably use it if the
> default result name was going to be configurable in the future (guess
> there's a patch waiting to be coded there).
>
> For now though I just hard coded the name attribute on all my results, not
> big deal.
>
> The reason I asked is that I'm building the example app based on a
> struts-based package, so I was aiming for the ideal.
>
> Thanks
> Adam
>
>
> Gabriel Belingueres on 18/06/08 14:32, wrote:
>>
>> I don't really know if you can change this default, but here is a
>> workaround:
>>
>> Write a custom interceptor that each time your action result is LIST,
>> you change it to SUCCESS.
>>
>> This way you could leave your result tags untouched. However, right
>> now I could not imagine the value of doing that.
>>
>> 2008/6/17, Adam Hardy <ah...@cyberspaceroad.com>:
>>>
>>> Hi,
>>>
>>> is it possible to do this:
>>>
>>> <action name="category/list"
>>> class="repo.CategoryAction" method="list">
>>> <result>categoryList.tile</result>
>>> </action>
>>>
>>> for result = "LIST" rather than "SUCCESS"? - I mean I want to use LIST
>>> as
>>> the default when none is defined, rather than SUCCESS - I find it more
>>> intuitive for my app.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: default result name other than SUCCESS?
Posted by Adam Hardy <ah...@cyberspaceroad.com>.
I guessed it's not modifiable but I figured I'd ask to make sure.
I like the work-around, hadn't thought of it. I'd probably use it if the default
result name was going to be configurable in the future (guess there's a patch
waiting to be coded there).
For now though I just hard coded the name attribute on all my results, not big
deal.
The reason I asked is that I'm building the example app based on a struts-based
package, so I was aiming for the ideal.
Thanks
Adam
Gabriel Belingueres on 18/06/08 14:32, wrote:
> I don't really know if you can change this default, but here is a workaround:
>
> Write a custom interceptor that each time your action result is LIST,
> you change it to SUCCESS.
>
> This way you could leave your result tags untouched. However, right
> now I could not imagine the value of doing that.
>
> 2008/6/17, Adam Hardy <ah...@cyberspaceroad.com>:
>> Hi,
>>
>> is it possible to do this:
>>
>> <action name="category/list"
>> class="repo.CategoryAction" method="list">
>> <result>categoryList.tile</result>
>> </action>
>>
>> for result = "LIST" rather than "SUCCESS"? - I mean I want to use LIST as
>> the default when none is defined, rather than SUCCESS - I find it more
>> intuitive for my app.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: default result name other than SUCCESS?
Posted by Gabriel Belingueres <be...@gmail.com>.
I don't really know if you can change this default, but here is a workaround:
Write a custom interceptor that each time your action result is LIST,
you change it to SUCCESS.
This way you could leave your result tags untouched. However, right
now I could not imagine the value of doing that.
2008/6/17, Adam Hardy <ah...@cyberspaceroad.com>:
> Hi,
>
> is it possible to do this:
>
> <action name="category/list"
> class="repo.CategoryAction" method="list">
> <result>categoryList.tile</result>
> </action>
>
> for result = "LIST" rather than "SUCCESS"? - I mean I want to use LIST as
> the default when none is defined, rather than SUCCESS - I find it more
> intuitive for my app.
>
>
> Thanks
> Adam
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org