Thursday, 11 May 2017

Spring Boot Web Request Redirected to Dispatcher Again






If you like me followed https://spring.io/guides/gs/spring-boot/ and not able to open a web page hosted by Spring Boot , then this post may help you.






Let's say you are using Spring Boot 1.5.3.RELEASE and have a controller defined as below :



When you put http://localhost:8080/login in the browser, it would end up below error :




From the console error log we can tell that request reached controller then system should load the resource login.jsp accordingly , but login.jsp is considered as a request since no controller is listening on login.jsp then it becomes NOT FOUND. 




How to resolve it ?


STEP 1 : add below dependency to POM 

<dependency>
     <groupId>org.apache.tomcat.embed</groupId>
     <artifactId>tomcat-embed-jasper</artifactId>
     <scope>provided</scope>
 </dependency>

<dependency>    

    <groupId>javax.servlet</groupId>    
    <artifactId>jstl</artifactId>
</dependency>


STEP 2 : define below class






DONE

No comments:

Post a Comment

Flag Counter