Last modified by Steve Peery on 2013/05/29 14:41

From version 4.1
edited by Pascal Robert
on 2011/12/27 06:47
Change comment: There is no comment for this version
To version 5.1
edited by Pascal Robert
on 2011/12/27 06:58
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -56,7 +56,7 @@
56 56  
57 57  Remove the Hello World text from the HTML and replace it with:
58 58  
59 -{{code}}
59 +{{code language="java" theme="Eclipse"}}
60 60  <wo:str value = "$myTextForDisplay" />
61 61  {{/code}}
62 62  
... ... @@ -64,4 +64,26 @@
64 64  
65 65  The application is now displaying the string for the Java variable You can terminate the application.
66 66  
67 -Final step: making the string truly variable by having a small text field to update the string. To do so, go back into the Main component editor view and just after the&nbsp;
67 +Final step: making the string truly variable by having a small text field to update the string. To do so, go back into the Main component editor view and just after the //<wo:str_ call, add~://
68 +
69 +{{code language="java" theme="Eclipse"}}
70 +
71 +<br />
72 +<wo:form>
73 +<wo:textfield value = "$myTextForDisplay" />
74 +<wo:submit action = "~updateString" />
75 +</wo:form>
76 +
77 +{{/code}}
78 +
79 +Now we have a simple form to update the string. The only thing we need to do is to implement the //updateString// method. Open the **Main.java** file and add the following code:
80 +
81 +{{code language="java" theme="Eclipse"}}
82 +
83 + public WOActionResults updateString() {
84 + return null;
85 + }
86 +
87 +{{/code}}
88 +
89 +Run the project again, and update the string in the text field. It's now 100% dynamic! Since we added a setter for the variable a couple of steps before, you don't need to set the string in the updateString method, that's the power of bindings.