Witajcie, mam pewien problem otoż dopiero zaczynam swoją przygodę ze springiem i nie mogę się pozbyć "Whitelabel Error Page" zacząłem robić pewien przykład z książki i pojawił się "Whitelabel"-404 a wszystko wydawało się ok , wchodzie na start.spring.io pobieram "hello word'a" również uzyskuję bląd tzn w consoli springa wszystko jest ok , próbowałem również odpalić przykładową stronę eclipsie na Vm i również przyklad ze strony springa to 404 próbowałem już chyba wszystkich pomysłów z Youtube ,i stack 'a jedynie raz udało mi się uruchomić stronę z project z start spring ale teraz już to się nie odpal ;/ miał ktoś kiedyś podobny problem, już chyba próbowałem wszystkiego 3 dni kombinuje co by to zrobić i bez skutku
Home Controller
package com.packt.webstore.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class HomeController {
@GetMapping("/")
public String welcome(Model model) {
model.addAttribute("greeting", "Witaj w sklepie internetowym!");
model.addAttribute("tagline", "Wyjątkowym i jedynym sklepieinternetowym");
return "welcome";
}
}
//welcome.jsp
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8">
<link
rel="stylesheet"href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/c
ss/bootstrap.min.css">
<title>Witaj</title>
</head>
<body>
<section>
<div class="jumbotron">
<div class="container">
<h1> ${greeting} </h1>
<p> ${tagline} </p>
</div>
</div>
</section>
</body>
</html>
// DefaultServlet-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/springbeans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/springcontext-4.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc4.0.xsd">
<mvc:annotation-driven />
<context:component-scan base-package="com.packt.webstore" />
<bean
class="org.springframework.web.servlet.view.InternalResourceViewR
esolver">
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
</beans>
// i web.xml
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<servlet>
<servlet-name>DefaultServlet</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>DefaultServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>