1、applicationContext.xml放在WEB-INF目录下,如果要放到别的地方,在web.xml中加入下面一句
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring/*Context.xml</param-value>
</context-param>
2、Spring与WebWork的结合无须像spring与struts的结合一样,须在action中代理。直接在web.xml中写个listener启动一下
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
然后在webwork.properties中加入
webwork.objectFactory=spring
webwork的验证
在配置中加入validationWorkflowStack
<interceptor-ref name="validationWorkflowStack" />
validationWorkflowStack是由下面3个拦截器(在webwork-default.xml中)组成的
<interceptor-stack name="validationWorkflowStack">
<interceptor-ref name="defaultStack"/>
<interceptor-ref name="validation"/>
<interceptor-ref name="workflow"/>
</interceptor-stack>
4、GET方式提交的乱码问题
在TOMCAT的server.xml中
<Connector port="8080"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true"
URIEncoding="UTF-8" useBodyEncodingForURI="true" />
其中 URIEncoding="UTF-8" useBodyEncodingForURI="true" 是需要新增的
然后在URL中用URLEncoder.encode(user.getUsername(),"utf-8")转码一次