I'm having a problem trying to get it up . In index.jsp ( where the app starts) I have ...
<jsp:forward page="hello.do"></jsp:forward>
Then, in web.xml I have defined the servlet dispatcher :
<!-- Servlet para levantar el dispatcher servlet de spring MVC -->
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
So, everything that ends with .do, should be taken by the controller . That works . The controller defined is :
@Controller
@RequestMapping("/hello")
public class HelloWorldController {
@RequestMapping(method=RequestMethod.GET)
public String procesar(HttpServletRequest request,ModelMap modelo){
System.out.println("todo jodidamente correcto");
String mensaje = "Hola, perras";
modelo.addAttribute("message",mensaje);
return "hello";
}
}
I can see the message, but it fails when it gets to -- return "hello" -- , that I still have the same exception :
javax.servlet.ServletException: Could not resolve view with name 'hello' in servlet with name 'dispatcher' org.springframework.web.servlet.DispatcherServlet. render(DispatcherServlet.java:1013) org.springframework.web.servlet.DispatcherServlet. doDispatch(DispatcherServlet.java:815) org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:717) org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:644) org.springframework.web.servlet.FrameworkServlet.d oGet(FrameworkServlet.java:549) javax.servlet.http.HttpServlet.service(HttpServlet .java:617) javax.servlet.http.HttpServlet.service(HttpServlet .java:717)
my tile definition is :
<tiles-definitions>
<definition name="topfisio.layout" template="/layouts/three-layer.jsp">
<put-attribute name="title" value="Top fisio" />
<put-attribute name="header" value="/jsp/header.jsp" />
<put-attribute name="footer" value="/jsp/footer.jsp" />
</definition>
<definition name="*" extends="topfisio.layout">
<put-attribute name="title" value="{1}" />
<put-attribute name="content" value="/jsp/{1}.jsp"/>
</definition>
</tiles-definitions>
and my file structure is :
index.jsp WEB-INF WEB-INF -- dispatcher-servlet.xml WEB-INF -- tiles-def.xml WEB-INF -- web.xml layouts layouts -- three-layer.jsp jsp jsp -- footer.jsp jsp -- header.jsp jsp -- hello.jsp
I may have a problem with tiles definitions , but I still cant find it