I'm putting together a simple little web app with Scalatra and was wondering if I can type HTML and Scala together in a get method. For example:
import org.scalatra._
class ROFLServlet extends Rofl_roster_managementStack {
get("/") {
<html>
<body>
<h1>Hello, world!</h1>
Say <a href="hello-scalate">hello to ROFL</a>.
</body>
</html>
println("Hello world!")
println("This is some Scala code I want to run.")
}
}
So I am trying to send some HTML to the root page and also run some code on the backend. Is this an acceptable usage? It seemed like it was working for me at first but sometimes it doesn't seem to send anything to the front end (I just get a blank page.)