Spring MVC- Page Not Found error -
i'm trying implement variant of muliple file upload tutorial, , having issue getting application run.
i created spring mvc project in eclipse using template.
the controller has been implemented by
@controller public class fileuploadcontroller { @requestmapping(value = "/show", method = requestmethod.get) public string displayform() { return "uploadform"; } @requestmapping(value = "/save", method = requestmethod.get) public string save(@modelattribute("uploadform") fileuploadform uploadform, model map) { //get file name , copy server location return "uploadsuccess" }
where uploadform
, uploadsuccess
jsp pages within views
my web.xml file defined as
<display-name>samplefileupload</display-name> <servlet> <servlet-name>spring</servlet-name> <servlet-class> org.springframework.web.servlet.dispatcherservlet </servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>spring</servlet-name> <url-pattern>*.html</url-pattern> </servlet-mapping>
and spring-servlet.xml
file defined as
<context:annotation-config /> <context:component-scan base-package = "com.jasonjohns.spring.fileupload.controller" /> <bean id = "multipartresolver" class = "org.springframework.web.multipart.commons.commonsmultipartresolver" /> <bean id = "jspviewresolver" class = "org.springframework.web.servlet.view.internalresourceviewresolver"> <property name = "viewclass" value = "org.springframework.web.servlet.view.jstlview" /> <property name = "prefix" value = "/web-inf/views/" /> <property name = "suffix" value = ".jsp" /> </bean>
however, when start application no errors found, exept server returning 404 error, when go localhost:8080/samplefileupload/show.html
. u'm guessing controller error, can't understand behind it.
did try changing mapping from:
@requestmapping(value = "/show", method = requestmethod.get)
to
@requestmapping(value = "/show.html", method = requestmethod.get)
Comments
Post a Comment