I am coming from the Java EE world. New to scala and Play. Looking at some sample applications. I see scala code in html files. I am able to understand the framework but I could not get scala.html files. Do I need to learn scala to use Play framework. Any work around.
You can use Java version of Play! without any scala skills. If you don't want to use scala.html templates you can get some module providing Java templates for Play20. Modules list can be found here.
Some examples with samples:
Groovy Template Engine for Play Framework 2.0
A full feaured Java-based template engine for Play2
Related
I'm using scala twirl templating outside the play framework (using akka-http instead) for generating email bodies, but it seems like intelliJ has no idea how to parse the twirl files (they are basically plain text files).
I would love to see some autocomplete support, etc for twirl. Is there any good plugins for that? The Scala plugin is supposed to have support for play 2.0 which should include twirl, but it seems like it won't do anything without Play.
I have just started using the Java Play framework, and I have a few questions...
I've developed a web application, which was managed using Maven 3.0, hosted on Tomcat 7.0, and containing a whole bunch of JSP files.
Our team recently decided to run everything using the Play framework, and I'm just wonder if there is a fast way to import my original project into Play? also, how does play recognise JSP files? where to put them?
Thank you
Unfortunately, play framework view template uses groovy (1.x) or scala (2.x) to render the data. Therefore, there is no way to use or replace the old jsp files in your new system. You have to convert the old bulk jsp files into the new views
I am trying to move from java to scala . I am basically a web developer where i use zkoss, vaadin as my framework. Do scala has widget based framework.Fully ajax based? I haven't tried lift and play need some advice is that fully ajax based?
The Vaadin framework can be used with Scala. There is even a project called Scaladin to help you with that. Since you already know it, I suggest you try learning scala with that framework. After you have a good understand of scala you should have a better base for what framework to choose in case you want to leave Vaadin.
Here are some resources:
Scala and Vaadin HOWTO
Scaladin wiki
Develop Vaadin apps with Scala
Try Scala+GWT with one of web frameworks (Lift, Play and etc.)
I found an old question "How to use the Play framework to develop a web service"
I'm trying to use Play 2.0 and Scala to do the same. Will everything still be the same on Play 2.0 with the exception of moving from Groovy templates to Scala templates?
A new example will be greatly appreciated.
There are lots and lots of changes in Play 2.0. The internal core API is in Scala, with the Java code being a wrapper.
There are three examples in the Play Framework code:
https://github.com/playframework/Play20/tree/master/samples
This may help you see what has changed between versions.
I'm tring to embed scalate in my website with sbt+jrebel, but found there are some problems I can't resolve.
So I want to know if there any other template engines based on scala?
How about popping on the Scalate group and describing the actual problems you're having? Am sure its fairly straight forward to work around? If the issue you're having is to do with sbt + jrebel and class reloading of scala code that you want to use inside your template engine; switching template engine's isn't sounding like an option (unless you want to stop using Scala in your templates). Plus Scalate is really the best and most popular template engine that uses Scala expressions inside it.
Play framework for scala has a brand new scala template engine
not sure if it can be used outside of play
http://scala.playframework.org/documentation/scala-0.9.1/templates
Pure Scala DSLs:
scala-xml (not sure how long this will be supported though)
ScalaTags
"Regular" templating engines:
Twirl
JSP (Java)
Freemarker (Java)
Velocity (Java)
Thymeleaf (Java)
Mustache.java (Java)
Thanks to String Interpolation from Scala 2.10, now we can use native syntax to generated a complex text content.
Just use Fastring. It has both good performance and simple usage.
If you're running on the JVM, Scala's interoperability with Java would let you use Velocity or Freemarker.
I might want to look at Stitchr which was largely inspired by StringTemplate
Scalasti is a Scala wrapper around StringTemplate.
As already mentioned above, I would recommend using Twirl (the template system from Play). It's now very easy to use standalone. You'll have compile time checking of your templates and many more cool and simple stuff:
https://github.com/spray/twirl