74. How to handle exceptions in struts

In Struts you can handle the exceptions in two ways:
a) Declarative Exception Handling: You can either define global exception handling tags in your struts-config.xml or define the exception handling tags within <action>..</action> tag.
Example:

<exception   key=”database.error.duplicate”
                    path=”/UserExists.jsp”
                    type=”mybank.account.DuplicateUserException”/>

b) Programmatic Exception Handling: Here you can use try{}catch{} block to handle the exception.

4 Responses

  1. Good day! 

    By the way, I love that too!  How did you find that?  

    See you soon! Girly Girl 

    see how I make free money with paid online surveys

  2. in struts , we can handle exception in two ways .

    1) programatica

    2)Declarative

    >under programatica , we write try, catch blocks in execute(-,-,-,-) of Action class .

    ->>There are two types exception handling in declarative mode
    a)local exception :
    writing tag under tag of struts config file

    b) global exception :
    writing tag under tag in struts config file

    b)global exception

  3. in struts , we can handle exception in two ways .
    1) programatica
    2)Declarative
    >under programatica , we write try, catch blocks in execute(-,-,-,-) of Action class .
    ->>There are two types exception handling in declarative mode
    a)local exception :
    writing “exception ” tag under “action” tag of struts config file
    b) global exception :
    writing “exception ” tag under “global-exception” tag in struts config file
    b)global exception

Leave a reply to hhhhhh Cancel reply