lundi 21 septembre 2020

Page is not loading on spring boot

I'm trying to build a spring boot application and when i load a jsp page it shows 404 error i'm using jasper to load the jsp below is my code Main File

@SpringBootApplication
public class SpringAppApplication {

    public static void main(String[] args) {
        SpringApplication.run(SpringAppApplication.class, args);
    }

}

controller file

@Controller
public class ApplicationController {
    @RequestMapping("home")
    public String home() {
        return "index";
    }
}

properties file

server.port=8000
spring.mvc.view.suffix=.jsp
spring.mvc.view.prefix=/WEB-INF/pages/

dependencies

    <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jersey</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web-services</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.apache.tomcat/tomcat-jasper -->
        <dependency>
            <groupId>org.apache.tomcat</groupId>
            <artifactId>tomcat-jasper</artifactId>
            <version>9.0.38</version>
        </dependency>
    </dependencies>

when i run the app and access http://localhost:8000/home gives me a 404 How to solve this issue?




Aucun commentaire:

Enregistrer un commentaire