。。。我不打算把书中东西都弄过来,没意思,只阐述下自学遇到的问题
中文版209页说的“如果我们使用更为传统的web.xml来配置MultipartConfigElement的话,那么可以使用<servlet>中的<multipart-config>元素,如下所示”
<servlet>
....name和class之类的东西不写了,没什么用
<multipart-config>
<location>...</location>
<max-file-size>...</max-file-size>
<max-request-size>....</max-request-size>
</multipart-config>
</servlet>
写完后,对于multipart-config这个标签,web.xml报错,并且服务器也起不来,错误信息如下:
cvc-complex-type.2.4.a: Invalid content was found starting with element 'multipart-config'. One of '{"http://
java.sun.com/xml/ns/javaee":run-as, "http://java.sun.com/xml/ns/javaee":security-role-ref}' is expected.
网上搜索了下,原来是缺少xml规则。。。
http://www.springmodules.org/schema/cache/springmodules-cache.xsd
http://www.springmodules.org/schema/cache/springmodules-ehcache.xsd
把这一堆复制到根元素的xmlns:xsi中就不报错了。
其实这个问题倒没什么,烦的是这本书有时候就会有类似于这样的坑。。。。直接告诉你怎么做,却不说先决条件,到底是老外的书啊。。