Hi,

aurmam wrote:
Hi i am trying tu use spring injection
like was written here

http://click.sourceforge.net/docs/extras-api/net/sf/click/extras/spring/SpringClickServlet.html


This is the documentation for Click 1.5.2 which is the old maintenance release.

As you are using Click 2.0.1 you should use the following doc:
http://incubator.apache.org/click/docs/extras-api/org/apache/click/extras/spring/SpringClickServlet.html


public class AdminPage extends BorderPage {

        private Functions functions;
        
        public void setFunctions(Functions functions) {
                this.functions = functions;
        }
public AdminPage() {
                
                if (hasPermission(Permission.LOGIN)) {
                        logger.error("rules for user :" + getUserName());
                        logger.error("text" + functions.getTextas());
                }
            getModel().put("title", getUserName() );
        }
}


The problem I think is that "functions" are used in the Page constructor. Spring will only inject services "after" the Page is constructed. So you should move that code to the onSecurityCheck or onInit method.

Hope this helps.

bob

Reply via email to