Spring MVC, Returning HTML -


here controller method:

@requestmapping(value = "/login/{id}", method = requestmethod.get) public string dologin(@pathvariable long id, httpservletrequest request, httpservletresponse response, model model) {  logger.info(string.format(               constants.logmessages.new_get_request_from_ip,               request.getremoteaddr()));  logger.info("/login/{id}");  return "login";  } 

and appservlet-context.xml:

    <!-- resolves views selected rendering @controllers .jsp resources in /web-inf/views directory --> <beans:bean class="org.springframework.web.servlet.view.internalresourceviewresolver">     <beans:property name="prefix" value="/web-inf/views/" />     <beans:property name="suffix" value=".html" /> </beans:bean> 

the exception in method :

warn pagenotfound - no mapping found http request uri [/project/web-inf/views/login.html] in dispatcherservlet name 'appservlet' 

thing is, when change "suffix" .jsp , name of file html .jsp works.

any idea why?

edit:

here web.xml:

<context-param>  <param-name>contextconfiglocation</param-name>  <param-value>/web-inf/spring/root-context.xml</param-value> 

<listener-class>org.springframework.web.context.contextloaderlistener</listener-class> 

<servlet-name>appservlet</servlet-name>  <servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class>  <init-param>    <param-name>contextconfiglocation</param-name>    <param-value>/web-inf/spring/appservlet/servlet-context.xml</param-value>  </init-param>  <load-on-startup>1</load-on-startup> 

<servlet-name>appservlet</servlet-name>  <url-pattern>/</url-pattern> 

<filter-name>cors</filter-name>  <filter-class>src.com.project.context.corsfilter</filter-class> 

<filter-name>cors</filter-name>  <url-pattern>/*</url-pattern> 

in .xml file try changing:

<servlet-name>appservlet</servlet-name>  <url-pattern>/</url-pattern> 

to:

<servlet-name>appservlet</servlet-name>  <url-pattern>*.html</url-pattern> 

Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -