0

When I am running this app from IDE, it is working fine, but when app running from the command line, it gives me the following error:

http://localhost:8080/welcome

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback. Thu Dec 30 21:46:01 BDT 2021 There was an unexpected error (type=Not Found, status=404)

My controller is :

package com.example.demo;

@Controller
public class HelloController {


    @RequestMapping("/welcome")
    public String home() {
        System.out.println("this is home page");

        return "home";
    }

}

application.properties

spring.mvc.view.prefix=/views/
spring.mvc.view.suffix=.jsp

Jsp file loction is :

webapp\views\home.jsp

Dirk Deyne
  • 6,048
  • 1
  • 15
  • 32
  • 1
    What do you mean by 'app running from the command line'? `java -jar your-app.jar`? – Dirk Deyne Dec 30 '21 at 17:42
  • java -jar spring-boot-ap.jar – Gulam Samdani Dec 30 '21 at 18:05
  • With JSPs, you may be better off making a `war` instead of a `jar`... Have a look here: [is-it-possible-with-spring-boot-to-serve-up-jsps-with-a-jar-packagin](https://stackoverflow.com/questions/21243690/is-it-possible-with-spring-boot-to-serve-up-jsps-with-a-jar-packaging) – Dirk Deyne Dec 30 '21 at 18:14
  • it works for me. can you check this repository ? https://github.com/joonseolee/basic-jsp – Joonseo Lee Mar 20 '22 at 12:28

0 Answers0