struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrian CHIA <>
Subject RE: Exception Mapping Annotation seems not inhierted
Date Wed, 27 Jul 2016 07:53:22 GMT
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

I defined this in the struts.xml

<package name="default" extends="struts-default">


    <result name="exception">/ error/error.jsp</result>

    <result name="runtime_exception"> /error/error.jsp</result>

    <result name="error"> error/error.jsp</result>



    <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>



Then I have this in the package-info



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.


With regards

Adrian Chia

-----Original Message-----
From: Lukasz Lenart []
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 <<>>:

> Hi


> It seems that the struts 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.




+ 48 606 323 122


To unsubscribe, e-mail:<>

For additional commands, e-mail:<>

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.
  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message