문제

Take the following example :

package com.example.app

import org.scalatra._
import scalate.ScalateSupport

class MyServlet extends ScalatraServlet with ScalateSupport {

  get("/") {
    <html>
      <body>
        <h1>Hello, world!</h1>
        Say <a href="hello-scalate">hello to Scalate</a>.
      </body>
    </html>
  }
}

Is this a DSL? i am wondering about the mechanism of how this work.

도움이 되었습니까?

해결책

Scala natively supports xml syntax and, by extension, xhtml. So no DSL, just a language feature.

다른 팁

Scala has support of XML literals on language level.

Scala's XML literal syntax is actually sugar for a series of Elem and Text instantiations

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top