在action中私有化service属性,并生成set方法。同时在配置文件中将service的bean注入到action的bean中
例如:配置文件中:
action中:
public
class
orderaction
extends
actionsupport{
//
注入orderservice
private
orderservice
orderservice;
public
void
setorderservice(orderservice
orderservice)
{
this.orderservice
=
orderservice;
}
struts.xml里action的class应写成spring里对应bean的id
。只有这样spring容器才会自动的将papermanager注入