Scala XML: brace escapes in attributes

Viewed 1829

I'm fiddling around with scala's XML capabilities, trying to produce some xhtml form. Here's what I got:

class LoginForm {
    var title = "Login"
    var username = ""
    def content =
        <div class="login">
            <h1>{this.title}</h1>
            <input type="text" name="username" value="{this.username}" />
        </div>
}
var f = new LoginForm
f.username = "foo"
f.content

When the code is run, the title is interpolated as expected, but the value of the input element is not. Why is this? And is there a way around that problem?

1 Answers
Related