You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by JOSE L MARTINEZ-AVIAL <jl...@gmail.com> on 2015/10/07 20:26:26 UTC
Use global result from another result
Hello,
I have a global result defined as follows:
<result name="message.handled.as.newtarget"
type="tiles">common.error.screen.newtarget</result>
And then I have an action that can return success, and go to a specific and
defined result, but in any other case I want the action to use the global
result already defined. For example"
<action name="downloadDocument"
class="com.test.DownloadDocument">
<result type="stream">
<param name="inputName">documentStream</param>
<param name="bufferSize">1024</param>
<param name="allowCaching">true</param>
</result>
<result name="*">message.handled.as.newtarget</result>
</action>
So if the result is anything other than success (input, error, none),for
example due to a invalid parameter, it should use
message.handled.as.newtarget. Is there anyway to do this?
Thanks
JL
Re: Use global result from another result
Posted by Lukasz Lenart <lu...@apache.org>.
2015-10-07 20:26 GMT+02:00 JOSE L MARTINEZ-AVIAL <jl...@gmail.com>:
> Hello,
> I have a global result defined as follows:
> <result name="message.handled.as.newtarget"
> type="tiles">common.error.screen.newtarget</result>
>
> And then I have an action that can return success, and go to a specific and
> defined result, but in any other case I want the action to use the global
> result already defined. For example"
>
> <action name="downloadDocument"
> class="com.test.DownloadDocument">
> <result type="stream">
> <param name="inputName">documentStream</param>
> <param name="bufferSize">1024</param>
> <param name="allowCaching">true</param>
> </result>
> <result name="*">message.handled.as.newtarget</result>
> </action>
>
> So if the result is anything other than success (input, error, none),for
> example due to a invalid parameter, it should use
> message.handled.as.newtarget. Is there anyway to do this?
Nope, it isn't possible but you can try to use UnknownHandler to
handle such case.
Regards
--
Łukasz
+ 48 606 323 122 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: Use global result from another result
Posted by Lukasz Lenart <lu...@apache.org>.
2015-10-08 10:07 GMT+02:00 JOSE L MARTINEZ-AVIAL <jl...@gmail.com>:
> Yes, that would be a solution, but it would be great to be able to map
> 'standard' result names (input, error) to global-results. We don't have
> that need frequently, but once in a while we do, and that would work for us.
Not sure but this should work
<result name="input" type="tiles">${resultName}</result>
Regards
--
Łukasz
+ 48 606 323 122 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: Use global result from another result
Posted by JOSE L MARTINEZ-AVIAL <jl...@gmail.com>.
Yes, that would be a solution, but it would be great to be able to map
'standard' result names (input, error) to global-results. We don't have
that need frequently, but once in a while we do, and that would work for us.
JL
2015-10-08 3:34 GMT-04:00 Christoph Nenning <Ch...@lex-com.net>:
> > From: JOSE L MARTINEZ-AVIAL <jl...@gmail.com>
> > To: Struts Users Mailing List <us...@struts.apache.org>,
> > Date: 07.10.2015 20:25
> > Subject: Use global result from another result
> >
> > Hello,
> > I have a global result defined as follows:
> > <result name="message.handled.as.newtarget"
> > type="tiles">common.error.screen.newtarget</result>
> >
> > And then I have an action that can return success, and go to a specific
> and
> > defined result, but in any other case I want the action to use the
> global
> > result already defined. For example"
> >
> > <action name="downloadDocument"
> > class="com.test.DownloadDocument">
> > <result type="stream">
> > <param name="inputName">documentStream</param>
> > <param name="bufferSize">1024</param>
> > <param name="allowCaching">true</param>
> > </result>
> > <result name="*">message.handled.as.newtarget</result>
> > </action>
> >
> > So if the result is anything other than success (input, error, none),for
> > example due to a invalid parameter, it should use
> > message.handled.as.newtarget. Is there anyway to do this?
> >
> > Thanks
> >
> > JL
>
>
> You could define the same result with several names:
>
> <result name="input" type="tiles">common.error.screen.newtarget</result>
> <result name="error" type="tiles">common.error.screen.newtarget</result>
> <result name="none" type="tiles">common.error.screen.newtarget</result>
>
>
> Regards,
> Christoph
>
> This Email was scanned by Sophos Anti Virus
>
Re: Use global result from another result
Posted by Christoph Nenning <Ch...@lex-com.net>.
> From: JOSE L MARTINEZ-AVIAL <jl...@gmail.com>
> To: Struts Users Mailing List <us...@struts.apache.org>,
> Date: 07.10.2015 20:25
> Subject: Use global result from another result
>
> Hello,
> I have a global result defined as follows:
> <result name="message.handled.as.newtarget"
> type="tiles">common.error.screen.newtarget</result>
>
> And then I have an action that can return success, and go to a specific
and
> defined result, but in any other case I want the action to use the
global
> result already defined. For example"
>
> <action name="downloadDocument"
> class="com.test.DownloadDocument">
> <result type="stream">
> <param name="inputName">documentStream</param>
> <param name="bufferSize">1024</param>
> <param name="allowCaching">true</param>
> </result>
> <result name="*">message.handled.as.newtarget</result>
> </action>
>
> So if the result is anything other than success (input, error, none),for
> example due to a invalid parameter, it should use
> message.handled.as.newtarget. Is there anyway to do this?
>
> Thanks
>
> JL
You could define the same result with several names:
<result name="input" type="tiles">common.error.screen.newtarget</result>
<result name="error" type="tiles">common.error.screen.newtarget</result>
<result name="none" type="tiles">common.error.screen.newtarget</result>
Regards,
Christoph
This Email was scanned by Sophos Anti Virus