Spring MVC does not work when there is no ServletConfig
One way to initialise the spring context is to use a
org.springframework.web.context.ContextLoaderListener. When you do, there
are not necessarily any configuration parameters for the servlet
in web.xml, so setServletConfig never gets called. However,
initServletContext. The fix for this is to create a fake ServletConfig
and call setServletConfig from initServletContext.
Also, I've added a new example which shows how to use this, along with
simple examples of form submission, adding model attributes and
redirection.
This is in github PR 49: https://github.com/scalate/scalate/pull/49
org.springframework.web.context.ContextLoaderListener. When you do, there
are not necessarily any configuration parameters for the servlet
in web.xml, so setServletConfig never gets called. However,
initServletContext. The fix for this is to create a fake ServletConfig
and call setServletConfig from initServletContext.
Also, I've added a new example which shows how to use this, along with
simple examples of form submission, adding model attributes and
redirection.
This is in github PR 49: https://github.com/scalate/scalate/pull/49
Leave a comment