This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Scala Server Pages

5 replies
Matt Hildebrand
Joined: 2009-03-25,
User offline. Last seen 42 years 45 weeks ago.

Hello,

FYI, I am finishing up an implementation of support for Scala Server
Pages -- like JSPs, but for Scala instead of Java. If anyone is
interested, just let me know and I'll make the source available.

There is no support for tag libraries, EL, or anything like JSTL, but
it does support basics such as <%...%>, <%=...%>, recompilation when
the .ssp source changes, etc.. There is also a lightweight syntax for
HTML-/XML-escaping output: ${__} is equivalent to <%=__%>, except
that __ is HTML-escaped before being output, much like in JSTL but shorter thanks to
hijacking the otherwise unused EL syntax and a bit more flexible
because __ can be any Scala expression.

There are definite rough spots, but it works and is sufficient for my
purposes. (Or, rather, it will be as soon as I finish up the last few
items on my 'to do' list.)

Best,
-Matt

Randall R Schulz
Joined: 2008-12-16,
User offline. Last seen 1 year 29 weeks ago.
Re: Scala Server Pages

On Wednesday March 25 2009, Matt Hildebrand wrote:
> Hello,
>
> FYI, I am finishing up an implementation of support for Scala Server
> Pages -- like JSPs, but for Scala instead of Java. If anyone is
> interested, just let me know and I'll make the source available.

Are you familiar with Google XML Pages? If so, how does your SSP
compare? I thought of it because it has some functional aspects. In
particular, there's strong typing of templates and values used within
the templates and side-effects are discouraged. There are slides
describing it.

-
(redirects to the previous URL)
(slides from OSCON 2008)

> ...
>
> Best,
> -Matt

Randall Schulz

ArtemGr
Joined: 2009-01-12,
User offline. Last seen 4 days 21 hours ago.
Re: Scala Server Pages

Matt Hildebrand writes:
> If anyone is
> interested, just let me know and I'll make the source available.

Interested. Definitely worth to be an opensource project.

Tupshin Harper
Joined: 2009-02-10,
User offline. Last seen 42 years 45 weeks ago.
Re: Scala Server Pages

FWIW, I'm using FreeMarker with Scala and loving the combination.
FreeMarker has very strong separation between presentation of the data
(in freemarker markup) and logic and the exposing of the presentation
data model (in Java or in my case Scala).
http://www.freemarker.org/features.html

-Tupshin

Matt Hildebrand wrote:
> Hello,
>
> FYI, I am finishing up an implementation of support for Scala Server
> Pages -- like JSPs, but for Scala instead of Java. If anyone is
> interested, just let me know and I'll make the source available.
>
> There is no support for tag libraries, EL, or anything like JSTL, but
> it does support basics such as <%...%>, <%=...%>, recompilation when
> the .ssp source changes, etc.. There is also a lightweight syntax for
> HTML-/XML-escaping output: ${__} is equivalent to <%=__%>, except
> that __ is HTML-escaped before being output, much like value="${__}" escapeXml="true"/> in JSTL but shorter thanks to
> hijacking the otherwise unused EL syntax and a bit more flexible
> because __ can be any Scala expression.
>
> There are definite rough spots, but it works and is sufficient for my
> purposes. (Or, rather, it will be as soon as I finish up the last few
> items on my 'to do' list.)
>
> Best,
> -Matt
>

ArtemGr
Joined: 2009-01-12,
User offline. Last seen 4 days 21 hours ago.
Re: Scala Server Pages

Tupshin Harper writes:
> FWIW, I'm using FreeMarker with Scala and loving the combination.
> FreeMarker has very strong separation between presentation of the data
> (in freemarker markup) and logic and the exposing of the presentation
> data model (in Java or in my case Scala).
> http://www.freemarker.org/features.html
>
> -Tupshin

There's also ZipScript: http://code.google.com/p/zipscript/

Matt Hildebrand
Joined: 2009-03-25,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: Scala Server Pages

>> If anyone is
>> interested, just let me know and I'll make the source available.
>
> Interested. Definitely worth to be an opensource project.

Ok, it's now available here:

http://github.com/matthild/serverpages/tree/master

There's a readme file that gives some instructions & commentary.

This project isn't a priority for me -- I put it together quickly over
the last few days while learning Scala, and am now turning to other
projects -- but if anyone has a use for something similar, you're
certainly welcome to use it. It's distributed under the permissive
ISC license (similar to a two-clause BSD license).

Best,
-Matt

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland