在service 中怎么用struts2中的valueStacke
在程序启动后? 配置拦截器? ,获取StrutsUtil。这样就可以在任何地方使用了。StrutsUtil.getValue(key);
?
/**
?* 拦截器
?*/
public class StrutsInterceptor implements Interceptor
{
???
??? /**
???? * 序列化UID
???? */
??? private static final long serialVersionUID = 8314186978343975405L;
???
??? /**
???? * 销毁
???? */
??? @Override
??? public void destroy()
??? {
???????
??? }
???
??? /**
???? * 初始化
???? */
??? @Override
??? public void init()
??? {
???????
??? }
???
??? /**
???? * 执行拦截
???? */
??? @Override
??? public String intercept(ActionInvocation actioninvocation) throws Exception
??? {
??????? ValueStack valueStack = actioninvocation.getStack();
??????? StrutsUtil strutsUtil = new StrutsUtil(valueStack, null, null);
??????? StrutsUtils.strutsUtil = strutsUtil;
??????? return actioninvocation.invoke();
??? }
}