Redirecting from a JSP to a controller Spring -


i have jsp want use call controller (that's linked jsp page) when url clicked, code follows:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <html> <body>     <h1>spring mvc hello world example</h1>      <h2>${msg}</h2>       <a href="/filemonitor/resultpage/">click</a>  </body> </html> 

the class want call @ /filemonitor/resultpage/ here:

@controller @requestmapping(value="/result") public class resultcontroller extends abstractcontroller {      @override     protected modelandview handlerequestinternal(httpservletrequest request,             httpservletresponse response) throws exception {          modelandview model = new modelandview("resultpage");         model.addobject("msg", "result");          return model;     }  } 

but i'm getting 404, can see i'm doing wrong? how can access controller jsp page?

try url tag jstl:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <html> <body>     <h1>spring mvc hello world example</h1>      <h2>${msg}</h2>      <a href="<c:url value="/filemonitor/resultpage/"/>">click</a>  </body> </html> 

Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -