Here is the code structure
Controller
@Controller
@RequestMapping("/")
public class indexController {
@RequestMapping(value="/",method=RequestMethod.GET)
public String home(){
return "index";
}
}
web.xml
although my views folder contains index.html but still when i run the project on server, browser shows 404 error.
please help
** because of tag i am not able to post the code of web.xml hence its a screenshot
web container treat .html format as static file , they don't render them but .jsp is their know extension , and they try to render that. So, If you put html files under, lets say static folder static/views/html/yourHtml.html and put something like this in configuration
mvc:resources mapping="/html/**" location="/static/views/html/"It should work then. This way they will be treated as resources files and they can be served. Hope it helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.