How to develop ajax web applications in Scala?
I'm looking for an object oriented web framework to develop Ajax applications in Scala. So, ideally I would like to have something like GWT but without mixing Java (client code) and Scala (server code).
Here is a short example of how Scala could create a vertical layout with a label and a list:
val label = new Label("nothing selected")
val list = new ListView("item1", "item2") onSelection { value => label.text = value }
pageContent = VerticalLayout(label, list)
Actually, this is nearly Scala Swing code开发者_高级运维. But why not choosing the same syntax for web applications?
For the question Can Scala be used to write GWT applications? ozone suggested to use the scalagwt project. The project looks very promising. However, it is still in an early stage and does not yet support a client-server communication (as far as I know) - I feature my web application depends on.
Other people suggested to use the lift framework and I'm wondering if lift allows to develop Ajax applications in a similar object oriented fashion as it is possible with GWT. I do not need the feature that client code is compiled into Java Script so that the client applications may even run completely without communication to the server. Instead I would not mind if every action in the browser leads to an Ajax request to the server and the server performs the corresponding operation and sends back JavaScript commands to the client in order to update parts of the webpage (e.g. to fill table X with content Y). A well designed API consisting of several UI components could be used to not only hide the HTML definitions of these components from the user but also the JS update commands that are performed in the background when the user updates an UI component in the Scala code (e.g. lable.text = ...
). Is there a module for lift or an alternative web framework providing such a object oriented definition of web applications?
Maybe you should take a look at Vaadin (a GWT-based framework with rich UI components), and in particular to its Scala support here.
I use Vaadin with Scala, too - it works very well.
精彩评论