click-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bob Schellink <sab...@gmail.com>
Subject Re: @Bindable annotation - binding dosn't work.
Date Wed, 14 Apr 2010 22:38:59 GMT
You don't need to specify getters and setters, however your click.xml needs at least:

<click-app charset="UTF-8">
     <pages package=".." autobinding="annotation"/>
     <mode value="trace"/>
</click-app>

Can you also confirm the version of Click used. Since you are using Netbeans have a look under
the 
'Files' tab at your web application 'build' folder, something like:

   'mycorp/build/web/WEB-INF/lib/'

Which version is being used?

kind regards

bob


On 15/04/2010 05:56, vxc vxc wrote:
> - I have made all templates ".htm".
> - I have added setters and getters for @Bindable protected String title
> - I did build clean, deploy, server restart and refreshed the browser
> but the result is the same.
> - I have deployed 'click-examples' and they seem to work fine
>
> My environment is:
>
> Build:
> - NetBeans 6.8
> - Java Platform: JDK 1.6
> - Framewor: Click Framework
> - Source/Binary Format: JDK 5
> - Win XP
>
> Run:
> - Tomcat 6.0.26 - default installation
> - Java EE Version: Java EE 5 (this comes from the project properties)
> - Java Platform: JDK 1.6 (this comes from the server properties)
> - Win XP
>
> Thank you!
>
>
> On Wed, Apr 7, 2010 at 10:03 AM, Bob Schellink<sabob1@gmail.com>  wrote:
>>
>> One thing that looks odd (but unrelated to your question) is you are using templates
with an ".html" extension. Click by default supports templates with an ".htm" extension. I
suggest you use .htm for Click templates and .html for static non-click pages.
>>
>> Wrt to your question it is possible that you are using a SecurityManager that does
not allow accessing protected/private variables. Could you expand on your environment a bit.
What JDK/Server/OS are you running on?
>>
>> Could you also deploy the Click 2.1.0 examples on the same server and see if it works?
>>
>> kind regards
>>
>> bob
>>
>>
>> On 8/04/2010 00:06, vxc vxc wrote:
>>>
>>> Thank you, but I do have it enabled:
>>>
>>> ------------------------------------------
>>> package clicktest.page;
>>>
>>> import org.apache.click.util.Bindable;
>>> import org.apache.click.Page;
>>>
>>> public class TestPage extends Page
>>> {
>>>      @Bindable protected String title = "My Title";
>>> -------------------------------------------------------
>>>
>>> ----click.xml--------------------------------------
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <click-app>
>>> <pages package="clicktest.page" autobinding="annotation"/>
>>> <!--
>>> <mode value="development"/>
>>> <mode value="debug"/>
>>> -->
>>> </click-app>
>>> --------------------------------------------
>>>
>>> When I change from:
>>> @Bindable protected String title = "My Title";
>>>
>>> To:
>>> @Bindable public String title = "My Title";
>>>
>>> ...binding works, but it dosn't work with 'protected'.
>>>
>>>
>>>
>>>
>>>
>>> On Tue, Apr 6, 2010 at 5:46 PM, Bob Schellink<sabob1@gmail.com
>>> <mailto:sabob1@gmail.com>>  wrote:
>>>
>>>     Hi,
>>>
>>>     Annotation binding isn't enabled by default (in upcoming 2.2.0 it
>>>     will be though). So what I think is missing in your click.xml is
>>>     setting autobinding to "annotation" mode:
>>>
>>>     <pages package="xxx.yyy.zzz" autobinding="annotation"/>
>>>
>>>     http://click.apache.org/docs/user-guide/html/ch04s02.html#application-autobinding-annotation
>>>
>>>     kind regards
>>>
>>>     bob
>>>
>>>
>>>
>>>     On 7/04/2010 8:24 AM, vxc vxc wrote:
>>>
>>>         I have:
>>>
>>>         ---------------------------test.html ---------------------------
>>>         <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>>>         <html>
>>>         <head>
>>>         <title></title>
>>>         <meta http-equiv="Content-Type" content="text/html;</head>
>>>
>>>         <body>
>>>              $title
>>>         </body>
>>>         </html>
>>>         ---------------------------
>>>
>>>         ---------------------------TestPage.java version 1
>>>         ---------------------------
>>>
>>>         import org.apache.click.util.Bindable;
>>>         import org.apache.click.Page;
>>>
>>>         public class TestPage extends Page
>>>         {
>>>              //@Bindable protected String title = "My Title";
>>>
>>>              public TestPage()
>>>              {
>>>                  addModel("title", "My Title");
>>>              }
>>>         }
>>>         ---------------------------
>>>
>>>         --------------------------- TestPage.java version 2
>>>         ---------------------------
>>>         import org.apache.click.util.Bindable;
>>>         import org.apache.click.Page;
>>>
>>>         public class TestPage extends Page
>>>         {
>>>              @Bindable protected String title = "My Title";
>>>
>>>         /*    public TestPage()
>>>              {
>>>                  addModel("title", "My Title");
>>>              }
>>>         */
>>>         }
>>>         ---------------------------
>>>
>>>         The first version of TestPage.java renders test.html correctly
>>>         as: My Title
>>>
>>>         The second version of TestPage.java renders test.html
>>>         incorrectly as: $title
>>>
>>>
>>>
>>>         Your helps is appreciated.
>>>         Thank you!
>>>
>>>
>>>
>>
>


Mime
View raw message