Reputation: 420921
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>
Upvotes: 28
Views: 6575
Reputation: 71
Using this , you won't miss the quotes : <a href={s"page?param=$Id"}>link</a>
Upvotes: 0
Reputation: 2524
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.
Upvotes: 2
Reputation: 15742
You put the whole thing inside the brackets:
<a href={ "page?param=" + id }>link</a>
Upvotes: 32