0

https://localhost:8080/observability/index.jsp?appli=Observability, this is 3rd party link on the main page and when we click it it has to open observability.html page

`I am using spring mvc for my application and below is the content of index.jsp**

<html>
<body>
<script>
    window.location="observability.html"
</script>
</body>
</html>

when we use spring boot application this redirection "window.location="observability.html" works fine and does not goes through controller, but when we are using Spring MVC,it is not working and it is going through controller.`

MvcConfig.java

@Configuration
@EnableWebMvc
@ComponentScan("com.xyz.abc")
public class MvcConfig implements  WebMvcConfigurer{
    @Bean
    public RestTemplate getRestTemplate() {
        RestTemplate restTemplate = new RestTemplate();
        return restTemplate;
    }
  
}

MyWebAppInitializer.java

public class MyWebAppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {

@Override
protected Class<?>[] getRootConfigClasses() {
    return new Class[] { PersistenceJPAConfig.class };
}

@Override
protected Class<?>[] getServletConfigClasses() {
    return new Class[] { MvcConfig.class };
}
@Override
protected String[] getServletMappings() {
    return new String[] {"/*"};
}

}

Ravi
  • 1
  • 1

0 Answers0