开发者

How to use Google Guice with struts (aka. struts 1)?

This problem is not related to struts 2.

I failed to find a solution to use gui开发者_Python百科ce inject my struts action, and seems no one talks about it. Is this too dumb a question or it is just impossible?

Thanks.


Ok, I comes with this:

@Override
public void setServlet(ActionServlet servlet) {
        super.setServlet(servlet);
        ServletContext context = servlet.getServletContext();
        Injector injector = (Injector)  context.getAttribute(MyGuiceServletContextListener.KEY);
            ......
}


To use Google Guice with struts 1 refer: https://code.google.com/p/google-guice-aop-struts1-integration/

Try this.


I am not sure what you are trying to achieve but may be this will help.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜