I am new to spring and am facing some challenges when I type in the url "localhost:8082/login?name=overflow"
I get this "Welcome ${name}!". And if I put in the url this "localhost:8082/login". I get an error This application has no explicit mapping for /error, so you are seeing this as a fallback. Any help will be appreciated
Application.properties file
spring.thymeleaf.prefix=classpath:/templates/mama/
spring.thymeleaf.suffix=.jsp
logging.level.org.springframework.web=DEBUG
Controller file
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
/**
*
* @author musa
*/
@Controller
public class LoginController {
@RequestMapping("/login")
public String loginMessage(@RequestParam String name,ModelMap model){
model.put("name", name);
//System.out.println("name is" + name);
return "login";
}
}
my login.jsp file
<!DOCTYPE html>
<html lang="en" xmlns:th="https://www.thymeleaf.org/">
<head>
<title>First web application</title>
</head>
<body>
<h1> Welcome ${name}!</h1>
</body>
</html>