Witam serdecznie mam dziwny problem i nie moge sobie z nim poradzic. Mam apkę webową z takim controlerem:
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import pl.ivmx.warsztaty6.dao.TestDao;
@Controller
public class HomeController {
private static final String VIEW_INDEX = "index";
@RequestMapping(value = "/", method = RequestMethod.GET)
public String welcome(ModelMap model) {
model.addAttribute("message", "Welcome Smart Home!");
// test polaczenia z modulem dao
model.addAttribute("testDao", new TestDao().testDao());
return VIEW_INDEX;
}
}
Oraz mvc-dispatcher-servlet :
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<context:component-scan base-package="pl.ivmx.warsztaty6.controller" />
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/pages/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
</beans>
I gdy odpalam apkę przy tym ustawieniu wszystko sie odpala ładnie. Ale zależy mi na stronach html zamiast jsp i zmieniam suffix w dispatcherze na .html :
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<context:component-scan base-package="pl.ivmx.warsztaty6.controller" />
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/pages/</value>
</property>
<property name="suffix">
<value>.html</value>
</property>
</bean>
</beans>
Dodaję sobie stronę html no i przy odpaleniu wywala mi " WARN [org.springframework.web.servlet.PageNotFound] (default task-2) No mapping found for HTTP request with URI [/SmartHome-wepapp/WEB-INF/pages/index.html] in DispatcherServlet with name 'mvc-dispatcher'" dlaczego przeciez mapowanie zrobione identycznie jak w przypadku stron jsp które działały poradzicie coś?