Struts2,Spring向action中注入service失败。
2个回答
展开全部
在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;
}
例如:配置文件中:
action中:
public
class
orderaction
extends
actionsupport{
//
注入orderservice
private
orderservice
orderservice;
public
void
setorderservice(orderservice
orderservice)
{
this.orderservice
=
orderservice;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询