Child pages
  • Your First Project - Hello World

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Remove the Hello World text from the HTML and replace it with:

Code Block
languagejava
themeEclipse
<wo:str value = "$myTextForDisplay" />

...

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 the <wo:str call, add:

Code Block
languagejava
themeEclipse

<br />
<wo:form>
<wo:textfield value = "$myTextForDisplay" />
<wo:submit action = "~updateString" />
</wo:form>

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:

Code Block
languagejava
themeEclipse

	public WOActionResults updateString() {
		return null;
	}

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.