Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6851955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:18:43+00:00 2026-05-27T01:18:43+00:00

how to show a custom error page when user fails to see a page

  • 0

how to show a custom error page when user fails to see a page (when do not have specific permission) after getting HTTP 500 –

org.springframework.security.access.AccessDeniedException: Access is denied

Exception from custom hasPermission() method.

You can check my previous question here to see my code.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T01:18:44+00:00Added an answer on May 27, 2026 at 1:18 am

    In your struts2 config file you can configure global exceptions like

    <global-exception-mappings>
        <exception-mapping exception="org.springframework.security.access.AccessDeniedException" result="securityerror" />
         <exception-mapping exception="java.lang.Exception" result="error" />
       </global-exception-mappings>
    
      <global-results>
            <result name="securityerror">/securityerror.jsp</result>
        <result name="error">/error.jsp</result>
       </global-results>
    

    that will work for application level if you find fine grained exception handling thing you can define it for action level itself

    <action name="actionspecificexception" class="org.apache.struts.register.action.Register" method="throwSecurityException">
         <exception-mapping exception="org.springframework.security.access.AccessDeniedException" 
              result="login" />
          <result>/register.jsp</result>
          <result name="login">/login.jsp</result>
       </action>
    

    So it depends upon you choice how you want to configure it.for details refer.

    Exception handling in Struts2

    My suggestion is not to throw every exception as a raw one better create your own exception wrappers and wrap such exceptions in them it will help you to organize your code in better way

    Hope this will help you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not seeing the real error in my custom error page when using an
I want to show a custom error page on Joomla for error messages like
I am using .htaccess to show custom HTML page for errors (401, 404, 500
I have a custom dialog page that contains a text box. When the user
I have configured an error 500 page with a controller an a view to
I have created a flexible navigation bar in my app that will show custom
I have a custom module I made to show featured products on the homepage.
How can I configure ASP.NET/IIS to show custom error pages (i.e. a nice friendly
I created my own custom error page by changing the line in config.php $route['404_override']
I want to create a custom error page to handle all unhandled exceptions. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.