今天踩过的坑——structs和spring

struts

如果实现了CookiesAware了,还需要引用org.apache.struts2.interceptor.CookieInterceptor过滤器,否则拿不到值
同时还要能看到这样的错误No object in the CompoundRoot has a publicly accessible property named 'JSESSIONID'
解决办法是

1 把struts.devMode设为false
2 增加一个setJSESSIONID(String value)的空方法

spring自动加载

想按名称加载
写成struts.objectFactory.spring.autoWire = name不行,必须写成struts.objectFactory.spring.autoWire = auto

需要写成struts.objectFactory.spring.autoWire = name

private calculatorService cs;
public void setCs1(calculatorService cs){
this.cs = cs;
}

<bean id="cs1" class="goodspeed.web.services.calculatorServiceImpl"></bean>

你可能感兴趣的:(spring)