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

  • Home
  • SEARCH
  • 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 6860739
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:26:47+00:00 2026-05-27T02:26:47+00:00

Below is my spring configuration file: <bean class=com.web.handler.CustomSimpleMappingExceptionResolver > <property name=exceptionMappings> <props> <prop key=java.lang.Throwable>error</prop>

  • 0

Below is my spring configuration file:

<bean class="com.web.handler.CustomSimpleMappingExceptionResolver" >
    <property name="exceptionMappings">
        <props>              
            <prop key="java.lang.Throwable">error</prop>
        </props>
    </property>
</bean>

Class CustomSimpleMappingExceptionResolver

public class CustomSimpleMappingExceptionResolver extends SimpleMappingExceptionResolver{
    @Override
    public ModelAndView resolveException(HttpServletRequest request,
            HttpServletResponse response, Object handler, Exception ex) {

    if(int a = 1)
        return new ModelAndView("ViewName1");
    else
        return new ModelAndView("ViewName2");
    }

My web.xml has no error page. I am looking to show different view according to my logic in resolveException().

In CustomSimpleMappingExceptionResolver class resolveException() is not being called in case of 404.

  • 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-27T02:26:47+00:00Added an answer on May 27, 2026 at 2:26 am

    Set error page in web.xml

    <error-page>
        <error-code>404</error-code>
        <location>/error.html</location>
    </error-page>
    

    your error page will redirect as soon as it opened.

    <html>
        <head>
        <title>Your Page Title</title>
        <meta http-equiv="REFRESH" content="0;url=error.htm">
        </head>
        <body>
        </body>
    </html>
    

    There should be a request mapping in your controller to handle error.htm request.

    @RequestMapping(value={"/error.htm"})
        ModelAndView routToErrorHandler(HttpServletRequest request, HttpServletResponse response) {
    //any logic for your themes
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I configured below exception resolver in my web configuration file but I am not
My spring-context file is shown below. <beans xmlns=http://www.springframework.org/schema/beans xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xmlns:aop=http://www.springframework.org/schema/aop xmlns:jee=http://www.springframework.org/schema/jee xmlns:jms=http://www.springframework.org/schema/jms xmlns:lang=http://www.springframework.org/schema/lang xmlns:tx=http://www.springframework.org/schema/tx
I have a Spring.NET program with a configuration file. To smooth the transition from
I'm reading an application configuration file form the code pasted below. My question is
I have three classes, one class loads in a configuration file into memory for
I've create a custom configuration section in my web.config file for my 3.5 web
I have below string output Version: 9.1.2(Build:40) Syntax version:4.00.10 Components: Engine Processors Configuration file:
The spring JDBC template returns me a list which looks like below: [{CODE_C=CSC, DESC_C=CSC},
I want to make spring MVC 3.0.3 portlet using DispatcherPortlet class With JSON support.
I have a console app containing an application configuration file containing one connection string

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.