I'm working with LiftWeb, XML and the bind method.
This works:
scala> val id = "test"
id: java.lang.String = test
scala> <a href={id}>link</a>
res4: scala.xml.Elem = <a href="test">link</a>
but what if I want <a href="page?param=test">link</a>
?
This doesn't work:
scala> <a href="page?param={id}">link</a>
res5: scala.xml.Elem = <a href="page?param={id}">link</a>
You put the whole thing inside the brackets:
<a href={ "page?param=" + id }>link</a>
The answer to put it all in curly braces is correct. But don't forget that you need to have a string in the curly braces!
So, you have to write something like (not your example, obviously)
<edge label={name} weight={weight.toString} />
If you come from a language which converts types for you, it can cost you a few minutes of head scratching before you remember what's wrong, because SBT offers no error message, just underlines it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With