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 6831105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:41:53+00:00 2026-05-26T22:41:53+00:00

I am working on an application in J2EE, Spring mvc. Application has two themes.

  • 0

I am working on an application in J2EE, Spring mvc.

Application has two themes. If java.lang.Exception comes it is handled.
I configure error page in web.xml as:

<error-page>
     <exception-type>java.lang.Exception</exception-type>
     <location>/WEB-INF/jsp/uncaughtException.jsp</location>
</error-page>

Each time in any theme uncaughtException.jsp is displayed. I want to show different page for different themes.

  • 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-26T22:41:54+00:00Added an answer on May 26, 2026 at 10:41 pm

    I did the following work around in order to show different message for different exception I think this trick can help you.

    I’just redirecting on exception with different message each time and show this message on the same page.

      @ExceptionHandler(Exception.class)
          public ModelAndView handleMyException(Exception  exception) {
             ModelAndView mv = new ModelAndView("redirect:errorMessage?error="+exception.getMessage());
             return mv;
                  } 
    
      @RequestMapping(value="/errorMessage", method=RequestMethod.GET)
      public ModelAndView handleMyExceptionOnRedirect(@RequestParamter("error") String error) {
          ModelAndView mv = new ModelAndView("uncaughtException");
          mv.addObject("error", error);
          return mv;
           } 
    

    Update:

    You can also use SimpleMappingExceptionResolver it might be more useful in your case:
    you can just map each exception to each page and the the default page.

    <bean id="exceptionResolver" class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
        <property name="exceptionMappings">
            <props>
                <prop key="org.springframework.dao.DataAccessException">/general/error/500</prop>
                <prop key="freemarker.core.InvalidReferenceException">/general/error/500</prop>
                <prop key="NumberFormatException">/general/error/500</prop>
            </props>
        </property>
        <property name="defaultErrorView" value="/general/error/500" />
    </bean>
    
    Update 2: I think you need to treat 404 separately.
    
    <error-page>
        <error-code>404</error-code>
        <location>/WEB-INF/pages/404.jsp</location>
      </error-page>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a J2EE web application that I'm working on and when an exception
i am working with some other people on a Spring MVC web application. If
I'm working with J2EE application and my web application has to recognize the user
I am working on an Java/J2EE web application. The persistence of data is made
I am working on a web application (J2EE) and I would like to know
Every time I start working on a new J2EE web application, I need to
I've try to implement integration tests for a working application (spring, hibernate, soap, cxf).
I am working on a J2EE application, to deploy I am using a build.xml
I am working on a j2ee project, which is a public website. The application
I'm working on an intranet-only web application (J2EE) that requires some basic security features.

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.