开发者

Inner class in Tapestry pages

开发者 https://www.devze.com 2023-01-31 05:27 出处:网络
Can we declare/create inner class in Tapestry page and acce开发者_开发问答ss it to the corresponding .tml page? If yes, then how? If not, could anyone explain why?

Can we declare/create inner class in Tapestry page and acce开发者_开发问答ss it to the corresponding .tml page? If yes, then how? If not, could anyone explain why?

Need your valuable input guys.


Yes, this works. The inner class is live reloaded but is not instrumented as a component class.

I've started using this technique to define data objects needed by the page, since I can update the @Validate annotations, or even change the available properties, on the fly.


I found the solution and am sharing it with you.

Let's assume we have a tapestry page named Tpage.

public class Tpage {  
    // variables  
    @Property  
    private TpageInnerClass innerclass;  

    //some methods  

    // Inner class  
    public class TpageInnerClass { 
        // variable  
        //methods  
    }
}  

Now you can access the inner class variable in Tpage.tml.

Hope it is clear to all of you. Though I am still looking for experts comments.

0

精彩评论

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