Hi Lukaz
You can ignore my email, as I realized that the package-info is not updated to
refer to the package defined in the xml.
With regards
Adrian Chia
Mobile: +65 93650999
From: Adrian CHIA
Sent: Wednesday, July 27, 2016 3:38 PM
To: Struts Developers List
Subject: RE: Exception Mapping Annotation seems not inhierted
Hi Łukasz
Sorry I meant to say that result mappings defined in the base class are being
"inherited" in the child class. I believe the framework actually will look for
the result in the parent class if it cannot be found in itself. Anyway I
updated the ExceptionMapping annotation with @Inherited so that my actions
which extends this base class will inherit the exception handling.
Alternatively, I tried defining the global exceptions handling in the struts
xml however it seems I cannot get it working together with annotation
configurations. Information as listed below.
I defined this in the struts.xml
<package name="default" extends="struts-default">
<global-results>
<result name="exception">/ error/error.jsp</result>
<result name="runtime_exception"> /error/error.jsp</result>
<result name="error"> error/error.jsp</result>
</global-results>
<global-exception-mappings>
<exception-mapping exception="java.lang.Exception"
result="exception"></exception-mapping>
<exception-mapping exception="java.lang.Error"
result="error"></exception-mapping>
<exception-mapping exception="java.lang.RuntimeException"
result="runtime_exception"></exception-mapping>
</global-exception-mappings>
</package>
Then I have this in the package-info
@ParentPackage(value="struts-default")
@Namespace("/dbsweb-forms/personal-loan")
package com.dbs.ploan.action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
In the Configuration Browser Plugin
The global exceptions mapping and result mapping are not listed here and when I
hit the action throwing the exception I did not get to see the error page.
[cid:[email protected]]
With regards
Adrian Chia
-----Original Message-----
From: Lukasz Lenart [mailto:[email protected]]
Sent: Wednesday, July 27, 2016 2:52 PM
To: Struts Developers List
Subject: Re: Exception Mapping Annotation seems not inhierted
2016-07-26 10:14 GMT+02:00 Adrian CHIA
<[email protected]<mailto:[email protected]>>:
> Hi
>
> It seems that the struts 2.3.4.1 Exception Mapping annotation cannot be
> inherited by the sub-classes. I attempted to put the annotation in the base
> class but the child class is unable to inherit the exception mapping. However
> results view can be inherited. Please advise ?
As far I see, it works that way from the very beginning. You can always define
global-exception-mappings in struts.xml. Also what do you mean by that the
"results view can be inherited" ?
@Results/@Result are defined without "@Inherited" meta-annotation so they work
the same, they aren't inherited by child classes.
Regards
--
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/
---------------------------------------------------------------------
To unsubscribe, e-mail:
[email protected]<mailto:[email protected]>
For additional commands, e-mail:
[email protected]<mailto:[email protected]>
CONFIDENTIAL NOTE:
The information contained in this email is intended only for the use of the
individual or entity named above and may contain information that is
privileged, confidential and exempt from disclosure under applicable law. If
the reader of this message is not the intended recipient, you are hereby
notified that any dissemination, distribution or copying of this communication
is strictly prohibited. If you have received this message in error, please
immediately notify the sender and delete the mail. Thank you.