This is my pom.xml file
pom.xml enter image description here
Application.properties File
#spring.thymeleaf.enabled=true
#spring.thymeleaf.prefix=/templates/
#spring.thymeleaf.suffix=.jsp
spring.mvc.view.prefix=/templates/
spring.mvc.view.suffix=.jsp
Home.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<title>Login Page</title>
</head>
<body>
<h1>Registration</h1>
</body>
</html>
Controller
@RestController
public class LoginController {
@GetMapping(path="/home")
public String loginPage() {
System.out.println("hello");
return "home";
}
}
Application File
@SpringBootApplication
public class SpringJspDemoApplication {
public static void main(String[] args)
{ SpringApplication.run(SpringJspDemoApplication.class, args); }
}
Output:
enter image description here this is the output I am getting a string value instead of jsp
Tried using Thymeleaf, tried to change @RestController-> @Controller, used @ComponentScan etc but issue not getting resolved.
Tried going through the solutions given on site but none of them are working for me, also they are quite older.
Project Structure :
enter image description here tried to put home.jsp at /webapp/WEB-INF/jsp/ that is also not working.
what will be the possible solution on this, can anyone please guide on this?
Below is the code when I change @Controller to @RestController [![
Controller File
Blockquote
And result is still
I have checked the status under network tab which is 200 only