Which method is preferable if I want to read a variable in my HTML-page? Is there a difference between the two?
class SomePage extends Page {
private String someVariable = "Some value";
public SomePage() {
addModel("someVariable", someVariable);
}
}
or
class SomePage extends Page {
@Bindable
private String someVariable = "Something";
}
The Apache Click documentation[1] is rich in content. Together with the online examples I can say how it is simply and intuitive. Specifically about your question, binding is explained in the application-autobinding section[3]. I tend to use the auto-binding mechanism only to request parameter and because of this warning in the docs:
[1] http://click.apache.org/docs/user-guide/htmlsingle/click-book.html
[2] http://click.avoka.com/click-examples/home.htm
[3] http://click.apache.org/docs/user-guide/html/ch05s02.html#application-autobinding